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