Documentation ¶
Index ¶
- Constants
- func Contain(slice, value interface{}) (index int)
- func ContainBool(slice []bool, value bool) (index int)
- func ContainFloat(slice []float64, value float64, places ...int) (index int)
- func ContainFloat32(slice []float32, value float32, places ...int) (index int)
- func ContainFloat64(slice []float64, value float64, places ...int) (index int)
- func ContainInt(slice []int, value int) (index int)
- func ContainInt32(slice []int32, value int32) (index int)
- func ContainInt64(slice []int64, value int64) (index int)
- func ContainString(slice []string, value string) (index int)
- func Count(slice interface{}) map[interface{}]int
- func CountBool(slice []bool) map[bool]int
- func CountFloat(slice []float64) map[float64]int
- func CountFloat32(slice []float32) map[float32]int
- func CountFloat64(slice []float64) map[float64]int
- func CountInt(slice []int) map[int]int
- func CountInt32(slice []int32) map[int32]int
- func CountInt64(slice []int64) map[int64]int
- func CountString(slice []string) map[string]int
- func Delete(slice, value interface{}, n int) ([]interface{}, int)
- func DeleteBool(slice []bool, value bool, n int) ([]bool, int)
- func DeleteFloat(slice []float64, value float64, n int, places ...int) ([]float64, int)
- func DeleteFloat32(slice []float32, value float32, n int, places ...int) ([]float32, int)
- func DeleteFloat64(slice []float64, value float64, n int, places ...int) ([]float64, int)
- func DeleteInt(slice []int, value, n int) ([]int, int)
- func DeleteInt32(slice []int32, value int32, n int) ([]int32, int)
- func DeleteInt64(slice []int64, value int64, n int) ([]int64, int)
- func DeleteString(slice []string, value string, n int) ([]string, int)
- func Equal(arr1, arr2 interface{}) bool
- func EqualBools(arr1, arr2 []bool) bool
- func EqualFloat32s(arr1, arr2 []float32, places ...int) bool
- func EqualFloat64s(arr1, arr2 []float64, places ...int) bool
- func EqualFloats(arr1, arr2 []float64, places ...int) bool
- func EqualInt32s(arr1, arr2 []int32) bool
- func EqualInt64s(arr1, arr2 []int64) bool
- func EqualInts(arr1, arr2 []int) bool
- func EqualStrings(arr1, arr2 []string) bool
- func Extract(slice interface{}, num int) []interface{}
- func ExtractBools(slice []bool, num int) []bool
- func ExtractFloat32s(slice []float32, num int) []float32
- func ExtractFloat64s(slice []float64, num int) []float64
- func ExtractFloats(slice []float64, num int) []float64
- func ExtractInt32s(slice []int32, num int) []int32
- func ExtractInt64s(slice []int64, num int) []int64
- func ExtractInts(slice []int, num int) []int
- func ExtractStrings(slice []string, num int) []string
- func Fill(value interface{}, num int) []interface{}
- func FillBool(value bool, num int) []bool
- func FillFloat(value float64, num int) []float64
- func FillFloat32(value float32, num int) []float32
- func FillFloat64(value float64, num int) []float64
- func FillInt(value, num int) []int
- func FillInt32(value int32, num int) []int32
- func FillInt64(value int64, num int) []int64
- func FillString(value string, num int) []string
- func Float64sToInterfaces(slice []float64) []interface{}
- func Float64sToStrings(slice []float64) []string
- func FloatsToInterfaces(slice []float64) []interface{}
- func FloatsToStrings(slice []float64) []string
- func Int64sToInterfaces(slice []int64) []interface{}
- func Int64sToStrings(slice []int64) []string
- func InterfacesToFloat64s(slice []interface{}) []float64
- func InterfacesToFloats(slice []interface{}) []float64
- func InterfacesToInt64s(slice []interface{}) []int64
- func InterfacesToInts(slice []interface{}) []int
- func InterfacesToStrings(slice []interface{}) []string
- func IntsToInterfaces(slice []int) []interface{}
- func IntsToStrings(slice []int) []string
- func Join(slice interface{}, sep ...string) (result string)
- func JoinBools(slice []bool, sep ...string) (result string)
- func JoinFloat32s(slice []float32, sep ...string) (result string)
- func JoinFloat64s(slice []float64, sep ...string) (result string)
- func JoinFloats(slice []float64, sep ...string) (result string)
- func JoinInt32s(slice []int32, sep ...string) (result string)
- func JoinInt64s(slice []int64, sep ...string) (result string)
- func JoinInts(slice []int, sep ...string) (result string)
- func JoinStrings(slice []string, sep ...string) (result string)
- func Reverse(slice interface{}) []interface{}
- func ReverseBools(slice []bool) []bool
- func ReverseFloat32s(slice []float32) []float32
- func ReverseFloat64s(slice []float64) []float64
- func ReverseFloats(slice []float64) []float64
- func ReverseInt32s(slice []int32) []int32
- func ReverseInt64s(slice []int64) []int64
- func ReverseInts(slice []int) []int
- func ReverseStrings(slice []string) []string
- func Shuffle(slice interface{}) []interface{}
- func ShuffleBools(slice []bool) []bool
- func ShuffleFloat32s(slice []float32) []float32
- func ShuffleFloat64s(slice []float64) []float64
- func ShuffleFloats(slice []float64) []float64
- func ShuffleInt32s(slice []int32) []int32
- func ShuffleInt64s(slice []int64) []int64
- func ShuffleInts(slice []int) []int
- func ShuffleStrings(slice []string) []string
- func SplitBools(str string, sep ...string) []bool
- func SplitFloat32s(str string, sep ...string) []float32
- func SplitFloat64s(str string, sep ...string) []float64
- func SplitFloats(str string, sep ...string) []float64
- func SplitInt32s(str string, sep ...string) []int32
- func SplitInt64s(str string, sep ...string) []int64
- func SplitInts(str string, sep ...string) []int
- func SplitStrings(str string, sep ...string) []string
- func StringsToFloat64s(slice []string) []float64
- func StringsToFloats(slice []string) []float64
- func StringsToInt64s(slice []string) []int64
- func StringsToInterfaces(slice []string) []interface{}
- func StringsToInts(slice []string) []int
- func Take(slice interface{}) interface{}
- func TakeBool(slice []bool) bool
- func TakeFloat(slice []float64) float64
- func TakeFloat32(slice []float32) float32
- func TakeFloat64(slice []float64) float64
- func TakeInt(slice []int) int
- func TakeInt32(slice []int32) int32
- func TakeInt64(slice []int64) int64
- func TakeString(slice []string) string
- func Unique(slice interface{}) []interface{}
- func UniqueBools(slice []bool) []bool
- func UniqueFloat32s(slice []float32) []float32
- func UniqueFloat64s(slice []float64) []float64
- func UniqueFloats(slice []float64) []float64
- func UniqueInt32s(slice []int32) []int32
- func UniqueInt64s(slice []int64) []int64
- func UniqueInts(slice []int) []int
- func UniqueStrings(slice []string) []string
Constants ¶
const (
// ValueIsNotContained means the value is not contained in the slice.
ValueIsNotContained = -1
)
Variables ¶
This section is empty.
Functions ¶
func Contain ¶
func Contain(slice, value interface{}) (index int)
Contain returns the index of the first instance of value in slice, or -1 if value is not present in slice. It panics if slice is invalid.
func ContainBool ¶
ContainBool returns the index of the first instance of bool value in bool slice, or -1 if value is not present in bool slice.
func ContainFloat ¶
ContainFloat returns the index of the first instance of float64 value in float64 slice, or -1 if value is not present in float64 slice. It will be judged equal if | v1 - v2 | <= 10 ^ -places, default places is 9.
func ContainFloat32 ¶
ContainFloat32 returns the index of the first instance of float32 value in float32 slice, or -1 if value is not present in float32 slice. It will be judged equal if | v1 - v2 | <= 10 ^ -places, default places is 9.
func ContainFloat64 ¶
ContainFloat64 returns the index of the first instance of float64 value in float64 slice, or -1 if value is not present in float64 slice. It will be judged equal if | v1 - v2 | <= 10 ^ -places, default places is 9.
func ContainInt ¶
ContainInt returns the index of the first instance of int value in int slice, or -1 if value is not present in int slice.
func ContainInt32 ¶
ContainInt32 returns the index of the first instance of int32 value in int32 slice, or -1 if value is not present in int32 slice.
func ContainInt64 ¶
ContainInt64 returns the index of the first instance of int64 value in int64 slice, or -1 if value is not present in int64 slice.
func ContainString ¶
ContainString returns the index of the first instance of string value in string slice, or -1 if value is not present in string slice.
func Count ¶
func Count(slice interface{}) map[interface{}]int
Count returns value count map by slice.
func CountFloat ¶
CountFloat returns float64 value count map by float64 slice.
func CountFloat32 ¶
CountFloat32 returns float32 value count map by float32 slice.
func CountFloat64 ¶
CountFloat64 returns float64 value count map by float64 slice.
func CountInt32 ¶
CountInt32 returns int32 value count map by int32 slice.
func CountInt64 ¶
CountInt64 returns int64 value count map by int64 slice.
func CountString ¶
CountString returns string value count map by string slice.
func Delete ¶
Delete returns the slice that deletes n specified value and the number of actual deletions. If n < 0, it will delete all specified value.
func DeleteBool ¶
DeleteBool returns the slice that deletes n specified bool value and the number of actual deletions. If n < 0, it will delete all specified bool value.
func DeleteFloat ¶
DeleteFloat returns the slice that deletes n specified float64 value and the number of actual deletions. If n < 0, it will delete all specified float64 value. It will be judged equal if | v1 - v2 | <= 10 ^ -places, default places is 9.
func DeleteFloat32 ¶
DeleteFloat32 returns the slice that deletes n specified float32 value and the number of actual deletions. If n < 0, it will delete all specified float32 value. It will be judged equal if | v1 - v2 | <= 10 ^ -places, default places is 9.
func DeleteFloat64 ¶
DeleteFloat64 returns the slice that deletes n specified float64 value and the number of actual deletions. If n < 0, it will delete all specified float64 value. It will be judged equal if | v1 - v2 | <= 10 ^ -places, default places is 9.
func DeleteInt ¶
DeleteInt returns the slice that deletes n specified int value and the number of actual deletions. If n < 0, it will delete all specified int value.
func DeleteInt32 ¶
DeleteInt32 returns the slice that deletes n specified int32 value and the number of actual deletions. If n < 0, it will delete all specified int32 value.
func DeleteInt64 ¶
DeleteInt64 returns the slice that deletes n specified int64 value and the number of actual deletions. If n < 0, it will delete all specified int64 value.
func DeleteString ¶
DeleteString returns the slice that deletes n specified string value and the number of actual deletions. If n < 0, it will delete all specified string value.
func Equal ¶
func Equal(arr1, arr2 interface{}) bool
Equal reports whether arr1 equals arr2. It panics if arr1 or arr2 is invalid.
func EqualBools ¶
EqualBools reports whether bool arr1 equals bool arr2.
func EqualFloat32s ¶
EqualFloat32s reports whether float32 arr1 equals float32 arr2. It will be judged equal if | v1 - v2 | <= 10 ^ -places, default places is 9.
func EqualFloat64s ¶
EqualFloat64s reports whether float64 arr1 equals float64 arr2. It will be judged equal if | v1 - v2 | <= 10 ^ -places, default places is 9.
func EqualFloats ¶
EqualFloats reports whether float64 arr1 equals float64 arr2. It will be judged equal if | v1 - v2 | <= 10 ^ -places, default places is 9.
func EqualInt32s ¶
EqualInt32s reports whether int32 arr1 equals int32 arr2.
func EqualInt64s ¶
EqualInt64s reports whether int64 arr1 equals int64 arr2.
func EqualStrings ¶
EqualStrings reports whether string arr1 equals string arr2.
func Extract ¶
func Extract(slice interface{}, num int) []interface{}
Extract returns randomly extracted num elements from slice. It panics if slice or num is invalid.
func ExtractBools ¶
ExtractBools returns randomly extracted num elements from bool slice. It panics if num is invalid.
func ExtractFloat32s ¶
ExtractFloat32s returns randomly extracted num elements from float32 slice. It panics if num is invalid.
func ExtractFloat64s ¶
ExtractFloat64s returns randomly extracted num elements from float64 slice. It panics if num is invalid.
func ExtractFloats ¶
ExtractFloats returns randomly extracted num elements from float64 slice. It panics if num is invalid.
func ExtractInt32s ¶
ExtractInt32s returns randomly extracted num elements from int64 slice. It panics if num is invalid.
func ExtractInt64s ¶
ExtractInt64s returns randomly extracted num elements from int64 slice. It panics if num is invalid.
func ExtractInts ¶
ExtractInts returns randomly extracted num elements from int slice. It panics if num is invalid.
func ExtractStrings ¶
ExtractStrings returns randomly extracted num elements from string slice. It panics if num is invalid.
func Fill ¶
func Fill(value interface{}, num int) []interface{}
Fill returns slice filled with value, where num is the number of value should be filled. It panics if num is invalid.
func FillBool ¶
FillBool returns bool slice filled with bool value, where num is the number of value should be filled. It panics if num is invalid.
func FillFloat ¶
FillFloat returns float64 slice filled with float64 value, where num is the number of value should be filled. It panics if num is invalid.
func FillFloat32 ¶
FillFloat32 returns float32 slice filled with float32 value, where num is the number of value should be filled. It panics if num is invalid.
func FillFloat64 ¶
FillFloat64 returns float64 slice filled with float64 value, where num is the number of value should be filled. It panics if num is invalid.
func FillInt ¶
FillInt returns int slice filled with int value, where num is the number of value should be filled. It panics if num is invalid.
func FillInt32 ¶
FillInt32 returns int32 slice filled with int32 value, where num is the number of value should be filled. It panics if num is invalid.
func FillInt64 ¶
FillInt64 returns int64 slice filled with int64 value, where num is the number of value should be filled. It panics if num is invalid.
func FillString ¶
FillString returns string slice filled with string value, where num is the number of value should be filled. It panics if num is invalid.
func Float64sToInterfaces ¶
func Float64sToInterfaces(slice []float64) []interface{}
Float64sToInterfaces returns converted interface slice by float64 slice.
func Float64sToStrings ¶
Float64sToStrings returns converted string slice by float64 slice.
func FloatsToInterfaces ¶
func FloatsToInterfaces(slice []float64) []interface{}
FloatsToInterfaces returns converted interface slice by float64 slice.
func FloatsToStrings ¶
FloatsToStrings returns converted string slice by float64 slice.
func Int64sToInterfaces ¶
func Int64sToInterfaces(slice []int64) []interface{}
Int64sToInterfaces returns converted interface slice by int64 slice.
func Int64sToStrings ¶
Int64sToStrings returns converted string slice by int64 slice.
func InterfacesToFloat64s ¶
func InterfacesToFloat64s(slice []interface{}) []float64
InterfacesToFloat64s returns converted float64 slice by interface slice.
func InterfacesToFloats ¶
func InterfacesToFloats(slice []interface{}) []float64
InterfacesToFloats returns converted float64 slice by interface slice.
func InterfacesToInt64s ¶
func InterfacesToInt64s(slice []interface{}) []int64
InterfacesToInt64s returns converted int64 slice by interface slice.
func InterfacesToInts ¶
func InterfacesToInts(slice []interface{}) []int
InterfacesToInts returns converted int slice by interface slice.
func InterfacesToStrings ¶
func InterfacesToStrings(slice []interface{}) []string
InterfacesToStrings returns converted string slice by interface slice.
func IntsToInterfaces ¶
func IntsToInterfaces(slice []int) []interface{}
IntsToInterfaces returns converted interface slice by int slice.
func IntsToStrings ¶
IntsToStrings returns converted string slice by int slice.
func Join ¶
Join returns string result of slice connected with string sep, default sep is ",". It panics if slice is invalid.
func JoinBools ¶
JoinBools returns string result of bool slice connected with string sep, default sep is ",".
func JoinFloat32s ¶
JoinFloat32s returns string result of float32 slice connected with string sep, default sep is ",".
func JoinFloat64s ¶
JoinFloat64s returns string result of float64 slice connected with string sep, default sep is ",".
func JoinFloats ¶
JoinFloats returns string result of float64 slice connected with string sep, default sep is ",".
func JoinInt32s ¶
JoinInt32s returns string result of int32 slice connected with string sep, default sep is ",".
func JoinInt64s ¶
JoinInt64s returns string result of int64 slice connected with string sep, default sep is ",".
func JoinInts ¶
JoinInts returns string result of int slice connected with string sep, default sep is ",".
func JoinStrings ¶
JoinStrings returns string result of string slice connected with string sep, default sep is ",".
func Reverse ¶
func Reverse(slice interface{}) []interface{}
Reverse returns the reverse order for slice. It panics if slice is invalid.
func ReverseBools ¶
ReverseBools returns the reverse order for bool slice.
func ReverseFloat32s ¶
ReverseFloat32s returns the reverse order for float64 slice.
func ReverseFloat64s ¶
ReverseFloat64s returns the reverse order for float64 slice.
func ReverseFloats ¶
ReverseFloats returns the reverse order for float64 slice.
func ReverseInt32s ¶
ReverseInt32s returns the reverse order for int32 slice.
func ReverseInt64s ¶
ReverseInt64s returns the reverse order for int64 slice.
func ReverseInts ¶
ReverseInts returns the reverse order for int slice.
func ReverseStrings ¶
ReverseStrings returns the reverse order for string slice.
func Shuffle ¶
func Shuffle(slice interface{}) []interface{}
Shuffle returns shuffled slice, it is equivalent to Extract(slice, len(slice)).
func ShuffleBools ¶
ShuffleBools returns shuffled bool slice, it is equivalent to ExtractBools(slice, len(slice)).
func ShuffleFloat32s ¶
ShuffleFloat32s returns shuffled float32 slice, it is equivalent to ExtractFloat32s(slice, len(slice)).
func ShuffleFloat64s ¶
ShuffleFloat64s returns shuffled float64 slice, it is equivalent to ExtractFloat64s(slice, len(slice)).
func ShuffleFloats ¶
ShuffleFloats returns shuffled float64 slice, it is equivalent to ExtractFloats(slice, len(slice)).
func ShuffleInt32s ¶
ShuffleInt32s returns shuffled int32 slice, it is equivalent to ExtractInt32s(slice, len(slice)).
func ShuffleInt64s ¶
ShuffleInt64s returns shuffled int64 slice, it is equivalent to ExtractInt64s(slice, len(slice)).
func ShuffleInts ¶
ShuffleInts returns shuffled int slice, it is equivalent to ExtractInts(slice, len(slice)).
func ShuffleStrings ¶
ShuffleStrings returns shuffled string slice, it is equivalent to ExtractStrings(slice, len(slice)).
func SplitBools ¶
SplitBools slices string str into substrings separated by string sep and returns bool slice of the converted substrings between those separators, default sep is ",".
func SplitFloat32s ¶
SplitFloat32s slices string str into substrings separated by string sep and returns float32 slice of the converted substrings between those separators, default sep is ",".
func SplitFloat64s ¶
SplitFloat64s slices string str into substrings separated by string sep and returns float64 slice of the converted substrings between those separators, default sep is ",".
func SplitFloats ¶
SplitFloats slices string str into substrings separated by string sep and returns float64 slice of the converted substrings between those separators, default sep is ",".
func SplitInt32s ¶
SplitInt32s slices string str into substrings separated by string sep and returns int32 slice of the converted substrings between those separators, default sep is ",".
func SplitInt64s ¶
SplitInt64s slices string str into substrings separated by string sep and returns int64 slice of the converted substrings between those separators, default sep is ",".
func SplitInts ¶
SplitInts slices string str into substrings separated by string sep and returns int slice of the converted substrings between those separators, default sep is ",".
func SplitStrings ¶
SplitStrings slices string str into substrings separated by string sep and returns string slice of the converted substrings between those separators, default sep is ",".
func StringsToFloat64s ¶
StringsToFloat64s returns converted float64 slice by string slice.
func StringsToFloats ¶
StringsToFloats returns converted float64 slice by string slice.
func StringsToInt64s ¶
StringsToInt64s returns converted int64 slice by string slice.
func StringsToInterfaces ¶
func StringsToInterfaces(slice []string) []interface{}
StringsToInterfaces returns converted interface slice by string slice.
func StringsToInts ¶
StringsToInts returns converted int slice by string slice.
func Take ¶
func Take(slice interface{}) interface{}
Take returns the randomly taken element from slice, it is equivalent to Extract(slice, 1)[0].
func TakeBool ¶
TakeBool returns the randomly taken bool element from bool slice, it is equivalent to ExtractBools(slice, 1)[0].
func TakeFloat ¶
TakeFloat returns the randomly taken float64 element from float64 slice, it is equivalent to ExtractFloats(slice, 1)[0].
func TakeFloat32 ¶
TakeFloat32 returns the randomly taken float32 element from float32 slice, it is equivalent to ExtractFloat32s(slice, 1)[0].
func TakeFloat64 ¶
TakeFloat64 returns the randomly taken float64 element from float64 slice, it is equivalent to ExtractFloat64s(slice, 1)[0].
func TakeInt ¶
TakeInt returns the randomly taken int element from int slice, it is equivalent to ExtractInts(slice, 1)[0].
func TakeInt32 ¶
TakeInt32 returns the randomly taken int32 element from int32 slice, it is equivalent to ExtractInt32s(slice, 1)[0].
func TakeInt64 ¶
TakeInt64 returns the randomly taken int64 element from int64 slice, it is equivalent to ExtractInt64s(slice, 1)[0].
func TakeString ¶
TakeString returns the randomly taken string element from string slice, it is equivalent to ExtractStrings(slice, 1)[0].
func Unique ¶
func Unique(slice interface{}) []interface{}
Unique returns the unique slice. It panics if slice is invalid.
func UniqueFloat32s ¶
UniqueFloat32s returns the unique float32 slice.
func UniqueFloat64s ¶
UniqueFloat64s returns the unique float64 slice.
func UniqueFloats ¶
UniqueFloats returns the unique float64 slice.
func UniqueInt32s ¶
UniqueInt32s returns the unique int32 slice.
func UniqueInt64s ¶
UniqueInt64s returns the unique int64 slice.
func UniqueStrings ¶
UniqueStrings returns the unique string slice.
Types ¶
This section is empty.