Documentation ¶
Overview ¶
Package slice provides typesafe functions for common Go slice operations.
Index ¶
- func ContainsBool(a []bool, x bool) bool
- func ContainsByte(a []byte, x byte) bool
- func ContainsComplex128(a []complex128, x complex128) bool
- func ContainsComplex64(a []complex64, x complex64) bool
- func ContainsFloat32(a []float32, x float32) bool
- func ContainsFloat64(a []float64, x float64) bool
- func ContainsInt(a []int, x int) bool
- func ContainsInt16(a []int16, x int16) bool
- func ContainsInt32(a []int32, x int32) bool
- func ContainsInt64(a []int64, x int64) bool
- func ContainsInt8(a []int8, x int8) bool
- func ContainsRune(a []rune, x rune) bool
- func ContainsString(a []string, x string) bool
- func ContainsUint(a []uint, x uint) bool
- func ContainsUint16(a []uint16, x uint16) bool
- func ContainsUint32(a []uint32, x uint32) bool
- func ContainsUint64(a []uint64, x uint64) bool
- func ContainsUint8(a []uint8, x uint8) bool
- func ContainsUintptr(a []uintptr, x uintptr) bool
- func CopyBool(a []bool) []bool
- func CopyByte(a []byte) []byte
- func CopyComplex128(a []complex128) []complex128
- func CopyComplex64(a []complex64) []complex64
- func CopyFloat32(a []float32) []float32
- func CopyFloat64(a []float64) []float64
- func CopyInt(a []int) []int
- func CopyInt16(a []int16) []int16
- func CopyInt32(a []int32) []int32
- func CopyInt64(a []int64) []int64
- func CopyInt8(a []int8) []int8
- func CopyRune(a []rune) []rune
- func CopyString(a []string) []string
- func CopyUint(a []uint) []uint
- func CopyUint16(a []uint16) []uint16
- func CopyUint32(a []uint32) []uint32
- func CopyUint64(a []uint64) []uint64
- func CopyUint8(a []uint8) []uint8
- func CopyUintptr(a []uintptr) []uintptr
- func DeduplicateBool(a []bool) []bool
- func DeduplicateByte(a []byte) []byte
- func DeduplicateComplex128(a []complex128) []complex128
- func DeduplicateComplex64(a []complex64) []complex64
- func DeduplicateFloat32(a []float32) []float32
- func DeduplicateFloat64(a []float64) []float64
- func DeduplicateInt(a []int) []int
- func DeduplicateInt16(a []int16) []int16
- func DeduplicateInt32(a []int32) []int32
- func DeduplicateInt64(a []int64) []int64
- func DeduplicateInt8(a []int8) []int8
- func DeduplicateRune(a []rune) []rune
- func DeduplicateString(a []string) []string
- func DeduplicateUint(a []uint) []uint
- func DeduplicateUint16(a []uint16) []uint16
- func DeduplicateUint32(a []uint32) []uint32
- func DeduplicateUint64(a []uint64) []uint64
- func DeduplicateUint8(a []uint8) []uint8
- func DeduplicateUintptr(a []uintptr) []uintptr
- func DeleteBool(a []bool, i int) ([]bool, error)
- func DeleteByte(a []byte, i int) ([]byte, error)
- func DeleteComplex128(a []complex128, i int) ([]complex128, error)
- func DeleteComplex64(a []complex64, i int) ([]complex64, error)
- func DeleteFloat32(a []float32, i int) ([]float32, error)
- func DeleteFloat64(a []float64, i int) ([]float64, error)
- func DeleteInt(a []int, i int) ([]int, error)
- func DeleteInt16(a []int16, i int) ([]int16, error)
- func DeleteInt32(a []int32, i int) ([]int32, error)
- func DeleteInt64(a []int64, i int) ([]int64, error)
- func DeleteInt8(a []int8, i int) ([]int8, error)
- func DeleteRangeBool(a []bool, from, to int) ([]bool, error)
- func DeleteRangeByte(a []byte, from, to int) ([]byte, error)
- func DeleteRangeComplex128(a []complex128, from, to int) ([]complex128, error)
- func DeleteRangeComplex64(a []complex64, from, to int) ([]complex64, error)
- func DeleteRangeFloat32(a []float32, from, to int) ([]float32, error)
- func DeleteRangeFloat64(a []float64, from, to int) ([]float64, error)
- func DeleteRangeInt(a []int, from, to int) ([]int, error)
- func DeleteRangeInt16(a []int16, from, to int) ([]int16, error)
- func DeleteRangeInt32(a []int32, from, to int) ([]int32, error)
- func DeleteRangeInt64(a []int64, from, to int) ([]int64, error)
- func DeleteRangeInt8(a []int8, from, to int) ([]int8, error)
- func DeleteRangeRune(a []rune, from, to int) ([]rune, error)
- func DeleteRangeString(a []string, from, to int) ([]string, error)
- func DeleteRangeUint(a []uint, from, to int) ([]uint, error)
- func DeleteRangeUint16(a []uint16, from, to int) ([]uint16, error)
- func DeleteRangeUint32(a []uint32, from, to int) ([]uint32, error)
- func DeleteRangeUint64(a []uint64, from, to int) ([]uint64, error)
- func DeleteRangeUint8(a []uint8, from, to int) ([]uint8, error)
- func DeleteRangeUintptr(a []uintptr, from, to int) ([]uintptr, error)
- func DeleteRune(a []rune, i int) ([]rune, error)
- func DeleteString(a []string, i int) ([]string, error)
- func DeleteUint(a []uint, i int) ([]uint, error)
- func DeleteUint16(a []uint16, i int) ([]uint16, error)
- func DeleteUint32(a []uint32, i int) ([]uint32, error)
- func DeleteUint64(a []uint64, i int) ([]uint64, error)
- func DeleteUint8(a []uint8, i int) ([]uint8, error)
- func DeleteUintptr(a []uintptr, i int) ([]uintptr, error)
- func FilterBool(a []bool, keep func(x bool) bool) []bool
- func FilterByte(a []byte, keep func(x byte) bool) []byte
- func FilterComplex128(a []complex128, keep func(x complex128) bool) []complex128
- func FilterComplex64(a []complex64, keep func(x complex64) bool) []complex64
- func FilterFloat32(a []float32, keep func(x float32) bool) []float32
- func FilterFloat64(a []float64, keep func(x float64) bool) []float64
- func FilterInt(a []int, keep func(x int) bool) []int
- func FilterInt16(a []int16, keep func(x int16) bool) []int16
- func FilterInt32(a []int32, keep func(x int32) bool) []int32
- func FilterInt64(a []int64, keep func(x int64) bool) []int64
- func FilterInt8(a []int8, keep func(x int8) bool) []int8
- func FilterRune(a []rune, keep func(x rune) bool) []rune
- func FilterString(a []string, keep func(x string) bool) []string
- func FilterUint(a []uint, keep func(x uint) bool) []uint
- func FilterUint16(a []uint16, keep func(x uint16) bool) []uint16
- func FilterUint32(a []uint32, keep func(x uint32) bool) []uint32
- func FilterUint64(a []uint64, keep func(x uint64) bool) []uint64
- func FilterUint8(a []uint8, keep func(x uint8) bool) []uint8
- func FilterUintptr(a []uintptr, keep func(x uintptr) bool) []uintptr
- func MaxByte(a []byte) (byte, error)
- func MaxFloat32(a []float32) (float32, error)
- func MaxFloat64(a []float64) (float64, error)
- func MaxInt(a []int) (int, error)
- func MaxInt16(a []int16) (int16, error)
- func MaxInt32(a []int32) (int32, error)
- func MaxInt64(a []int64) (int64, error)
- func MaxInt8(a []int8) (int8, error)
- func MaxRune(a []rune) (rune, error)
- func MaxUint(a []uint) (uint, error)
- func MaxUint16(a []uint16) (uint16, error)
- func MaxUint32(a []uint32) (uint32, error)
- func MaxUint64(a []uint64) (uint64, error)
- func MaxUint8(a []uint8) (uint8, error)
- func MaxUintptr(a []uintptr) (uintptr, error)
- func MinByte(a []byte) (byte, error)
- func MinFloat32(a []float32) (float32, error)
- func MinFloat64(a []float64) (float64, error)
- func MinInt(a []int) (int, error)
- func MinInt16(a []int16) (int16, error)
- func MinInt32(a []int32) (int32, error)
- func MinInt64(a []int64) (int64, error)
- func MinInt8(a []int8) (int8, error)
- func MinRune(a []rune) (rune, error)
- func MinUint(a []uint) (uint, error)
- func MinUint16(a []uint16) (uint16, error)
- func MinUint32(a []uint32) (uint32, error)
- func MinUint64(a []uint64) (uint64, error)
- func MinUint8(a []uint8) (uint8, error)
- func MinUintptr(a []uintptr) (uintptr, error)
- func PopBool(a []bool) (bool, []bool, error)
- func PopByte(a []byte) (byte, []byte, error)
- func PopComplex128(a []complex128) (complex128, []complex128, error)
- func PopComplex64(a []complex64) (complex64, []complex64, error)
- func PopFloat32(a []float32) (float32, []float32, error)
- func PopFloat64(a []float64) (float64, []float64, error)
- func PopInt(a []int) (int, []int, error)
- func PopInt16(a []int16) (int16, []int16, error)
- func PopInt32(a []int32) (int32, []int32, error)
- func PopInt64(a []int64) (int64, []int64, error)
- func PopInt8(a []int8) (int8, []int8, error)
- func PopRune(a []rune) (rune, []rune, error)
- func PopString(a []string) (string, []string, error)
- func PopUint(a []uint) (uint, []uint, error)
- func PopUint16(a []uint16) (uint16, []uint16, error)
- func PopUint32(a []uint32) (uint32, []uint32, error)
- func PopUint64(a []uint64) (uint64, []uint64, error)
- func PopUint8(a []uint8) (uint8, []uint8, error)
- func PopUintptr(a []uintptr) (uintptr, []uintptr, error)
- func ReverseBool(a []bool) []bool
- func ReverseByte(a []byte) []byte
- func ReverseComplex128(a []complex128) []complex128
- func ReverseComplex64(a []complex64) []complex64
- func ReverseFloat32(a []float32) []float32
- func ReverseFloat64(a []float64) []float64
- func ReverseInt(a []int) []int
- func ReverseInt16(a []int16) []int16
- func ReverseInt32(a []int32) []int32
- func ReverseInt64(a []int64) []int64
- func ReverseInt8(a []int8) []int8
- func ReverseRune(a []rune) []rune
- func ReverseString(a []string) []string
- func ReverseUint(a []uint) []uint
- func ReverseUint16(a []uint16) []uint16
- func ReverseUint32(a []uint32) []uint32
- func ReverseUint64(a []uint64) []uint64
- func ReverseUint8(a []uint8) []uint8
- func ReverseUintptr(a []uintptr) []uintptr
- func ShuffleBool(a []bool) []bool
- func ShuffleByte(a []byte) []byte
- func ShuffleComplex128(a []complex128) []complex128
- func ShuffleComplex64(a []complex64) []complex64
- func ShuffleFloat32(a []float32) []float32
- func ShuffleFloat64(a []float64) []float64
- func ShuffleInt(a []int) []int
- func ShuffleInt16(a []int16) []int16
- func ShuffleInt32(a []int32) []int32
- func ShuffleInt64(a []int64) []int64
- func ShuffleInt8(a []int8) []int8
- func ShuffleRune(a []rune) []rune
- func ShuffleString(a []string) []string
- func ShuffleUint(a []uint) []uint
- func ShuffleUint16(a []uint16) []uint16
- func ShuffleUint32(a []uint32) []uint32
- func ShuffleUint64(a []uint64) []uint64
- func ShuffleUint8(a []uint8) []uint8
- func ShuffleUintptr(a []uintptr) []uintptr
- func SumByte(a []byte) (byte, error)
- func SumComplex128(a []complex128) (complex128, error)
- func SumComplex64(a []complex64) (complex64, error)
- func SumFloat32(a []float32) (float32, error)
- func SumFloat64(a []float64) (float64, error)
- func SumInt(a []int) (int, error)
- func SumInt16(a []int16) (int16, error)
- func SumInt32(a []int32) (int32, error)
- func SumInt64(a []int64) (int64, error)
- func SumInt8(a []int8) (int8, error)
- func SumRune(a []rune) (rune, error)
- func SumUint(a []uint) (uint, error)
- func SumUint16(a []uint16) (uint16, error)
- func SumUint32(a []uint32) (uint32, error)
- func SumUint64(a []uint64) (uint64, error)
- func SumUint8(a []uint8) (uint8, error)
- func SumUintptr(a []uintptr) (uintptr, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsBool ¶
ContainsBool checks if a value exists in a bool slice
func ContainsByte ¶
ContainsByte checks if a value exists in a byte slice
func ContainsComplex128 ¶
func ContainsComplex128(a []complex128, x complex128) bool
ContainsComplex128 checks if a value exists in a complex128 slice
func ContainsComplex64 ¶
ContainsComplex64 checks if a value exists in a complex64 slice
func ContainsFloat32 ¶
ContainsFloat32 checks if a value exists in a float32 slice
func ContainsFloat64 ¶
ContainsFloat64 checks if a value exists in a float64 slice
func ContainsInt ¶
ContainsInt checks if a value exists in an int slice
Example ¶
a := []int{1, 2, 3, 0, 7, 5, 2} contains := ContainsInt(a, 7) fmt.Printf("%v", contains)
Output: true
func ContainsInt16 ¶
ContainsInt16 checks if a value exists in an int16 slice
func ContainsInt32 ¶
ContainsInt32 checks if a value exists in an int32 slice
func ContainsInt64 ¶
ContainsInt64 checks if a value exists in an int64 slice
func ContainsInt8 ¶
ContainsInt8 checks if a value exists in an int8 slice
func ContainsRune ¶
ContainsRune checks if a value exists in a rune slice
func ContainsString ¶
ContainsString checks if a value exists in a string slice
func ContainsUint ¶
ContainsUint checks if a value exists in a uint slice
func ContainsUint16 ¶
ContainsUint16 checks if a value exists in a uint16 slice
func ContainsUint32 ¶
ContainsUint32 checks if a value exists in a uint32 slice
func ContainsUint64 ¶
ContainsUint64 checks if a value exists in a uint64 slice
func ContainsUint8 ¶
ContainsUint8 checks if a value exists in a uint8 slice
func ContainsUintptr ¶
ContainsUintptr checks if a value exists in a uintptr slice
func CopyBool ¶
CopyBool creates a copy of a bool slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyByte ¶
CopyByte creates a copy of a byte slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyComplex128 ¶
func CopyComplex128(a []complex128) []complex128
CopyComplex128 creates a copy of a complex128 slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyComplex64 ¶
CopyComplex64 creates a copy of a complex64 slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyFloat32 ¶
CopyFloat32 creates a copy of a float32 slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyFloat64 ¶
CopyFloat64 creates a copy of a float64 slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyInt ¶
CopyInt creates a copy of an int slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyInt16 ¶
CopyInt16 creates a copy of an int16 slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyInt32 ¶
CopyInt32 creates a copy of an int32 slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyInt64 ¶
CopyInt64 creates a copy of an int64 slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyInt8 ¶
CopyInt8 creates a copy of an int8 slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyRune ¶
CopyRune creates a copy of a rune slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyString ¶
CopyString creates a copy of a string slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyUint ¶
CopyUint creates a copy of a uint slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyUint16 ¶
CopyUint16 creates a copy of a uint16 slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyUint32 ¶
CopyUint32 creates a copy of a uint32 slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyUint64 ¶
CopyUint64 creates a copy of a uint64 slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyUint8 ¶
CopyUint8 creates a copy of a uint8 slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func CopyUintptr ¶
CopyUintptr creates a copy of a uintptr slice. The resulting slice has the same elements as the original but the underlying array is different. See https://github.com/go101/go101/wiki
func DeduplicateBool ¶
DeduplicateBool performs order preserving, in place deduplication of a bool slice
func DeduplicateByte ¶
DeduplicateByte performs order preserving, in place deduplication of a byte slice
func DeduplicateComplex128 ¶
func DeduplicateComplex128(a []complex128) []complex128
DeduplicateComplex128 performs order preserving, in place deduplication of a complex128 slice
func DeduplicateComplex64 ¶
DeduplicateComplex64 performs order preserving, in place deduplication of a complex64 slice
func DeduplicateFloat32 ¶
DeduplicateFloat32 performs order preserving, in place deduplication of a float32 slice
func DeduplicateFloat64 ¶
DeduplicateFloat64 performs order preserving, in place deduplication of a float64 slice
func DeduplicateInt ¶
DeduplicateInt performs order preserving, in place deduplication of a int slice
Example ¶
a := []int{1, 2, 3, 2, 5, 3} a = DeduplicateInt(a) fmt.Printf("%v", a)
Output: [1 2 3 5]
func DeduplicateInt16 ¶
DeduplicateInt16 performs order preserving, in place deduplication of a int16 slice
func DeduplicateInt32 ¶
DeduplicateInt32 performs order preserving, in place deduplication of a int32 slice
func DeduplicateInt64 ¶
DeduplicateInt64 performs order preserving, in place deduplication of a int64 slice
func DeduplicateInt8 ¶
DeduplicateInt8 performs order preserving, in place deduplication of a int8 slice
func DeduplicateRune ¶
DeduplicateRune performs order preserving, in place deduplication of a rune slice
func DeduplicateString ¶
DeduplicateString performs order preserving, in place deduplication of a string slice
func DeduplicateUint ¶
DeduplicateUint performs order preserving, in place deduplication of a uint slice
func DeduplicateUint16 ¶
DeduplicateUint16 performs order preserving, in place deduplication of a uint16 slice
func DeduplicateUint32 ¶
DeduplicateUint32 performs order preserving, in place deduplication of a uint32 slice
func DeduplicateUint64 ¶
DeduplicateUint64 performs order preserving, in place deduplication of a uint64 slice
func DeduplicateUint8 ¶
DeduplicateUint8 performs order preserving, in place deduplication of a uint8 slice
func DeduplicateUintptr ¶
DeduplicateUintptr performs order preserving, in place deduplication of a uintptr slice
func DeleteBool ¶ added in v0.2.0
DeleteBool removes an element at a specific index of a bool slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteByte ¶ added in v0.2.0
DeleteByte removes an element at a specific index of a byte slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteComplex128 ¶ added in v0.2.0
func DeleteComplex128(a []complex128, i int) ([]complex128, error)
DeleteComplex128 removes an element at a specific index of a complex128 slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteComplex64 ¶ added in v0.2.0
DeleteComplex64 removes an element at a specific index of a complex64 slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteFloat32 ¶ added in v0.2.0
DeleteFloat32 removes an element at a specific index of a float32 slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteFloat64 ¶ added in v0.2.0
DeleteFloat64 removes an element at a specific index of a float64 slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteInt ¶ added in v0.2.0
DeleteInt removes an element at a specific index of an int slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
Example ¶
a := []int{1, 2, 3, 4, 5} a, err := DeleteInt(a, 2) fmt.Printf("%v, %v", a, err)
Output: [1 2 4 5], <nil>
func DeleteInt16 ¶ added in v0.2.0
DeleteInt16 removes an element at a specific index of an int16 slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteInt32 ¶ added in v0.2.0
DeleteInt32 removes an element at a specific index of an int32 slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteInt64 ¶ added in v0.2.0
DeleteInt64 removes an element at a specific index of an int64 slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteInt8 ¶ added in v0.2.0
DeleteInt8 removes an element at a specific index of an int8 slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteRangeBool ¶ added in v0.2.0
DeleteRangeBool deletes the elements between from and to index (inclusive) from a bool slice
func DeleteRangeByte ¶ added in v0.2.0
DeleteRangeByte deletes the elements between from and to index (inclusive) from a byte slice
func DeleteRangeComplex128 ¶ added in v0.2.0
func DeleteRangeComplex128(a []complex128, from, to int) ([]complex128, error)
DeleteRangeComplex128 deletes the elements between from and to index (inclusive) from a complex128 slice
func DeleteRangeComplex64 ¶ added in v0.2.0
DeleteRangeComplex64 deletes the elements between from and to index (inclusive) from a complex64 slice
func DeleteRangeFloat32 ¶ added in v0.2.0
DeleteRangeFloat32 deletes the elements between from and to index (inclusive) from a float32 slice
func DeleteRangeFloat64 ¶ added in v0.2.0
DeleteRangeFloat64 deletes the elements between from and to index (inclusive) from a float64 slice
func DeleteRangeInt ¶ added in v0.2.0
DeleteRangeInt deletes the elements between from and to index (inclusive) from a int slice
Example ¶
a := []int{1, 2, 3, 4, 5} a, err := DeleteRangeInt(a, 2, 3) fmt.Printf("%v, %v", a, err)
Output: [1 2 5], <nil>
func DeleteRangeInt16 ¶ added in v0.2.0
DeleteRangeInt16 deletes the elements between from and to index (inclusive) from a int16 slice
func DeleteRangeInt32 ¶ added in v0.2.0
DeleteRangeInt32 deletes the elements between from and to index (inclusive) from a int32 slice
func DeleteRangeInt64 ¶ added in v0.2.0
DeleteRangeInt64 deletes the elements between from and to index (inclusive) from a int64 slice
func DeleteRangeInt8 ¶ added in v0.2.0
DeleteRangeInt8 deletes the elements between from and to index (inclusive) from a int8 slice
func DeleteRangeRune ¶ added in v0.2.0
DeleteRangeRune deletes the elements between from and to index (inclusive) from a rune slice
func DeleteRangeString ¶ added in v0.2.0
DeleteRangeString deletes the elements between from and to index (inclusive) from a string slice
func DeleteRangeUint ¶ added in v0.2.0
DeleteRangeUint deletes the elements between from and to index (inclusive) from a uint slice
func DeleteRangeUint16 ¶ added in v0.2.0
DeleteRangeUint16 deletes the elements between from and to index (inclusive) from a uint16 slice
func DeleteRangeUint32 ¶ added in v0.2.0
DeleteRangeUint32 deletes the elements between from and to index (inclusive) from a uint32 slice
func DeleteRangeUint64 ¶ added in v0.2.0
DeleteRangeUint64 deletes the elements between from and to index (inclusive) from a uint64 slice
func DeleteRangeUint8 ¶ added in v0.2.0
DeleteRangeUint8 deletes the elements between from and to index (inclusive) from a uint8 slice
func DeleteRangeUintptr ¶ added in v0.2.0
DeleteRangeUintptr deletes the elements between from and to index (inclusive) from a uintptr slice
func DeleteRune ¶ added in v0.2.0
DeleteRune removes an element at a specific index of a rune slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteString ¶ added in v0.2.0
DeleteString removes an element at a specific index of a string slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteUint ¶ added in v0.2.0
DeleteUint removes an element at a specific index of a uint slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteUint16 ¶ added in v0.2.0
DeleteUint16 removes an element at a specific index of a uint16 slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteUint32 ¶ added in v0.2.0
DeleteUint32 removes an element at a specific index of a uint32 slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteUint64 ¶ added in v0.2.0
DeleteUint64 removes an element at a specific index of a uint64 slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteUint8 ¶ added in v0.2.0
DeleteUint8 removes an element at a specific index of a uint8 slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func DeleteUintptr ¶ added in v0.2.0
DeleteUintptr removes an element at a specific index of a uintptr slice. An error is return in case the index is out of bounds or if the slice is nil or empty.
func FilterBool ¶
FilterBool performs in place filtering of a bool slice based on a predicate
func FilterByte ¶
FilterByte performs in place filtering of a byte slice based on a predicate
func FilterComplex128 ¶
func FilterComplex128(a []complex128, keep func(x complex128) bool) []complex128
FilterComplex128 performs in place filtering of a complex128 slice based on a predicate
func FilterComplex64 ¶
FilterComplex64 performs in place filtering of a complex64 slice based on a predicate
func FilterFloat32 ¶
FilterFloat32 performs in place filtering of a float32 slice based on a predicate
func FilterFloat64 ¶
FilterFloat64 performs in place filtering of a float64 slice based on a predicate
func FilterInt ¶
FilterInt performs in place filtering of an int slice based on a predicate
Example ¶
a := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10} keep := func(x int) bool { return x%2 == 0 } a = FilterInt(a, keep) fmt.Println(a) // Output [2, 4, 6, 8 , 10]
Output:
func FilterInt16 ¶
FilterInt16 performs in place filtering of an int16 slice based on a predicate
func FilterInt32 ¶
FilterInt32 performs in place filtering of an int32 slice based on a predicate
func FilterInt64 ¶
FilterInt64 performs in place filtering of an int64 slice based on a predicate
func FilterInt8 ¶
FilterInt8 performs in place filtering of an int8 slice based on a predicate
func FilterRune ¶
FilterRune performs in place filtering of a rune slice based on a predicate
func FilterString ¶
FilterString performs in place filtering of a string slice based on a predicate
func FilterUint ¶
FilterUint performs in place filtering of a uint slice based on a predicate
func FilterUint16 ¶
FilterUint16 performs in place filtering of a uint16 slice based on a predicate
func FilterUint32 ¶
FilterUint32 performs in place filtering of a uint32 slice based on a predicate
func FilterUint64 ¶
FilterUint64 performs in place filtering of a uint64 slice based on a predicate
func FilterUint8 ¶
FilterUint8 performs in place filtering of a uint8 slice based on a predicate
func FilterUintptr ¶
FilterUintptr performs in place filtering of a uintptr slice based on a predicate
func MaxByte ¶
MaxByte returns the maximum value of a byte slice or an error in case of a nil or empty slice
func MaxFloat32 ¶
MaxFloat32 returns the maximum value of a float32 slice or an error in case of a nil or empty slice
func MaxFloat64 ¶
MaxFloat64 returns the maximum value of a float64 slice or an error in case of a nil or empty slice
func MaxInt ¶
MaxInt returns the maximum value of a int slice or an error in case of a nil or empty slice
Example ¶
a := []int{1, 2, 3, 0, 7, 5, 2} max, err := MaxInt(a) fmt.Printf("%d, %v", max, err)
Output: 7, <nil>
func MaxInt16 ¶
MaxInt16 returns the maximum value of a int16 slice or an error in case of a nil or empty slice
func MaxInt32 ¶
MaxInt32 returns the maximum value of a int32 slice or an error in case of a nil or empty slice
func MaxInt64 ¶
MaxInt64 returns the maximum value of a int64 slice or an error in case of a nil or empty slice
func MaxInt8 ¶
MaxInt8 returns the maximum value of a int8 slice or an error in case of a nil or empty slice
func MaxRune ¶
MaxRune returns the maximum value of a rune slice or an error in case of a nil or empty slice
func MaxUint ¶
MaxUint returns the maximum value of a uint slice or an error in case of a nil or empty slice
func MaxUint16 ¶
MaxUint16 returns the maximum value of a uint16 slice or an error in case of a nil or empty slice
func MaxUint32 ¶
MaxUint32 returns the maximum value of a uint32 slice or an error in case of a nil or empty slice
func MaxUint64 ¶
MaxUint64 returns the maximum value of a uint64 slice or an error in case of a nil or empty slice
func MaxUint8 ¶
MaxUint8 returns the maximum value of a uint8 slice or an error in case of a nil or empty slice
func MaxUintptr ¶
MaxUintptr returns the maximum value of a uintptr slice or an error in case of a nil or empty slice
func MinByte ¶
MinByte returns the minimum value of a byte slice or an error in case of a nil or empty slice
func MinFloat32 ¶
MinFloat32 returns the minimum value of a float32 slice or an error in case of a nil or empty slice
func MinFloat64 ¶
MinFloat64 returns the minimum value of a float64 slice or an error in case of a nil or empty slice
func MinInt ¶
MinInt returns the minimum value of an int slice or an error in case of a nil or empty slice
Example ¶
a := []int{1, 2, 3, 0, 7, 5, 2} min, err := MinInt(a) fmt.Printf("%d, %v", min, err)
Output: 0, <nil>
func MinInt16 ¶
MinInt16 returns the minimum value of an int16 slice or an error in case of a nil or empty slice
func MinInt32 ¶
MinInt32 returns the minimum value of an int32 slice or an error in case of a nil or empty slice
func MinInt64 ¶
MinInt64 returns the minimum value of an int64 slice or an error in case of a nil or empty slice
func MinInt8 ¶
MinInt8 returns the minimum value of an int8 slice or an error in case of a nil or empty slice
func MinRune ¶
MinRune returns the minimum value of a rune slice or an error in case of a nil or empty slice
func MinUint ¶
MinUint returns the minimum value of a uint slice or an error in case of a nil or empty slice
func MinUint16 ¶
MinUint16 returns the minimum value of a uint16 slice or an error in case of a nil or empty slice
func MinUint32 ¶
MinUint32 returns the minimum value of a uint32 slice or an error in case of a nil or empty slice
func MinUint64 ¶
MinUint64 returns the minimum value of a uint64 slice or an error in case of a nil or empty slice
func MinUint8 ¶
MinUint8 returns the minimum value of a uint8 slice or an error in case of a nil or empty slice
func MinUintptr ¶
MinUintptr returns the minimum value of a uintptr slice or an error in case of a nil or empty slice
func PopBool ¶ added in v0.2.0
PopBool removes and returns the last value a bool slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopByte ¶ added in v0.2.0
PopByte removes and returns the last value a byte slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopComplex128 ¶ added in v0.2.0
func PopComplex128(a []complex128) (complex128, []complex128, error)
PopComplex128 removes and returns the last value a complex128 slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopComplex64 ¶ added in v0.2.0
PopComplex64 removes and returns the last value a complex64 slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopFloat32 ¶ added in v0.2.0
PopFloat32 removes and returns the last value a float32 slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopFloat64 ¶ added in v0.2.0
PopFloat64 removes and returns the last value a float64 slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopInt ¶ added in v0.2.0
PopInt removes and returns the last value a int slice and the remaining slice. An error is returned in case of a nil or empty slice.
Example ¶
a := []int{1, 2, 3, 4, 5} v, a, err := PopInt(a) fmt.Printf("%d, %v, %v", v, a, err)
Output: 5, [1 2 3 4], <nil>
func PopInt16 ¶ added in v0.2.0
PopInt16 removes and returns the last value a int16 slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopInt32 ¶ added in v0.2.0
PopInt32 removes and returns the last value a int32 slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopInt64 ¶ added in v0.2.0
PopInt64 removes and returns the last value a int64 slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopInt8 ¶ added in v0.2.0
PopInt8 removes and returns the last value a int8 slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopRune ¶ added in v0.2.0
PopRune removes and returns the last value a rune slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopString ¶ added in v0.2.0
PopString removes and returns the last value a string slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopUint ¶ added in v0.2.0
PopUint removes and returns the last value a uint slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopUint16 ¶ added in v0.2.0
PopUint16 removes and returns the last value a uint16 slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopUint32 ¶ added in v0.2.0
PopUint32 removes and returns the last value a uint32 slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopUint64 ¶ added in v0.2.0
PopUint64 removes and returns the last value a uint64 slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopUint8 ¶ added in v0.2.0
PopUint8 removes and returns the last value a uint8 slice and the remaining slice. An error is returned in case of a nil or empty slice.
func PopUintptr ¶ added in v0.2.0
PopUintptr removes and returns the last value a uintptr slice and the remaining slice. An error is returned in case of a nil or empty slice.
func ReverseBool ¶
ReverseBool performs in place reversal of a bool slice
func ReverseByte ¶
ReverseByte performs in place reversal of a byte slice
func ReverseComplex128 ¶
func ReverseComplex128(a []complex128) []complex128
ReverseComplex128 performs in place reversal of a complex128 slice
func ReverseComplex64 ¶
ReverseComplex64 performs in place reversal of a complex64 slice
func ReverseFloat32 ¶
ReverseFloat32 performs in place reversal of a float32 slice
func ReverseFloat64 ¶
ReverseFloat64 performs in place reversal of a float64 slice
func ReverseInt ¶
ReverseInt performs in place reversal of an int slice
Example ¶
a := []int{1, 2, 3, 4, 5} a = ReverseInt(a) fmt.Printf("%v", a)
Output: [5 4 3 2 1]
func ReverseInt16 ¶
ReverseInt16 performs in place reversal of an int16 slice
func ReverseInt32 ¶
ReverseInt32 performs in place reversal of an int32 slice
func ReverseInt64 ¶
ReverseInt64 performs in place reversal of an int64 slice
func ReverseInt8 ¶
ReverseInt8 performs in place reversal of an int8 slice
func ReverseRune ¶
ReverseRune performs in place reversal of a rune slice
func ReverseString ¶
ReverseString performs in place reversal of a string slice
func ReverseUint ¶
ReverseUint performs in place reversal of a uint slice
func ReverseUint16 ¶
ReverseUint16 performs in place reversal of a uint16 slice
func ReverseUint32 ¶
ReverseUint32 performs in place reversal of a uint32 slice
func ReverseUint64 ¶
ReverseUint64 performs in place reversal of a uint64 slice
func ReverseUint8 ¶
ReverseUint8 performs in place reversal of a uint8 slice
func ReverseUintptr ¶
ReverseUintptr performs in place reversal of a uintptr slice
func ShuffleBool ¶ added in v0.2.0
ShuffleBool shuffles (in place) a bool slice
func ShuffleByte ¶ added in v0.2.0
ShuffleByte shuffles (in place) a byte slice
func ShuffleComplex128 ¶ added in v0.2.0
func ShuffleComplex128(a []complex128) []complex128
ShuffleComplex128 shuffles (in place) a complex128 slice
func ShuffleComplex64 ¶ added in v0.2.0
ShuffleComplex64 shuffles (in place) a complex64 slice
func ShuffleFloat32 ¶ added in v0.2.0
ShuffleFloat32 shuffles (in place) a float32 slice
func ShuffleFloat64 ¶ added in v0.2.0
ShuffleFloat64 shuffles (in place) a float64 slice
func ShuffleInt ¶ added in v0.2.0
ShuffleInt shuffles (in place) a int slice
func ShuffleInt16 ¶ added in v0.2.0
ShuffleInt16 shuffles (in place) a int16 slice
func ShuffleInt32 ¶ added in v0.2.0
ShuffleInt32 shuffles (in place) a int32 slice
func ShuffleInt64 ¶ added in v0.2.0
ShuffleInt64 shuffles (in place) a int64 slice
func ShuffleInt8 ¶ added in v0.2.0
ShuffleInt8 shuffles (in place) a int8 slice
func ShuffleRune ¶ added in v0.2.0
ShuffleRune shuffles (in place) a rune slice
func ShuffleString ¶ added in v0.2.0
ShuffleString shuffles (in place) a string slice
func ShuffleUint ¶ added in v0.2.0
ShuffleUint shuffles (in place) a uint slice
func ShuffleUint16 ¶ added in v0.2.0
ShuffleUint16 shuffles (in place) a uint16 slice
func ShuffleUint32 ¶ added in v0.2.0
ShuffleUint32 shuffles (in place) a uint32 slice
func ShuffleUint64 ¶ added in v0.2.0
ShuffleUint64 shuffles (in place) a uint64 slice
func ShuffleUint8 ¶ added in v0.2.0
ShuffleUint8 shuffles (in place) a uint8 slice
func ShuffleUintptr ¶ added in v0.2.0
ShuffleUintptr shuffles (in place) a uintptr slice
func SumByte ¶
SumByte returns the sum of the values of a byte Slice or an error in case of a nil or empty slice
func SumComplex128 ¶
func SumComplex128(a []complex128) (complex128, error)
SumComplex128 returns the sum of the values of a complex128 Slice or an error in case of a nil or empty slice
func SumComplex64 ¶
SumComplex64 returns the sum of the values of a complex64 Slice or an error in case of a nil or empty slice
func SumFloat32 ¶
SumFloat32 returns the sum of the values of a float32 Slice or an error in case of a nil or empty slice
func SumFloat64 ¶
SumFloat64 returns the sum of the values of a float64 Slice or an error in case of a nil or empty slice
func SumInt ¶
SumInt returns the sum of the values of a int Slice or an error in case of a nil or empty slice
Example ¶
a := []int{1, 2, 3} sum, err := SumInt(a) fmt.Printf("%d, %v", sum, err)
Output: 6, <nil>
func SumInt16 ¶
SumInt16 returns the sum of the values of a int16 Slice or an error in case of a nil or empty slice
func SumInt32 ¶
SumInt32 returns the sum of the values of a int32 Slice or an error in case of a nil or empty slice
func SumInt64 ¶
SumInt64 returns the sum of the values of a int64 Slice or an error in case of a nil or empty slice
func SumInt8 ¶
SumInt8 returns the sum of the values of a int8 Slice or an error in case of a nil or empty slice
func SumRune ¶
SumRune returns the sum of the values of a rune Slice or an error in case of a nil or empty slice
func SumUint ¶
SumUint returns the sum of the values of a uint Slice or an error in case of a nil or empty slice
func SumUint16 ¶
SumUint16 returns the sum of the values of a uint16 Slice or an error in case of a nil or empty slice
func SumUint32 ¶
SumUint32 returns the sum of the values of a uint32 Slice or an error in case of a nil or empty slice
func SumUint64 ¶
SumUint64 returns the sum of the values of a uint64 Slice or an error in case of a nil or empty slice
func SumUint8 ¶
SumUint8 returns the sum of the values of a uint8 Slice or an error in case of a nil or empty slice
func SumUintptr ¶
SumUintptr returns the sum of the values of a uintptr Slice or an error in case of a nil or empty slice
Types ¶
This section is empty.