Documentation
¶
Overview ¶
Slice provides high-performance slice management utilities.
Index ¶
- func CommonStrings(s1, s2 []string) []string
- func Contains(slice, contains interface{}) bool
- func ContainsBool(slice []bool, contains bool) bool
- func ContainsComplex128(slice []complex128, contains complex128) bool
- func ContainsComplex64(slice []complex64, contains complex64) bool
- func ContainsFloat32(slice []float32, contains float32) bool
- func ContainsFloat64(slice []float64, contains float64) bool
- func ContainsInt(slice []int, contains int) bool
- func ContainsInt16(slice []int16, contains int16) bool
- func ContainsInt32(slice []int32, contains int32) bool
- func ContainsInt64(slice []int64, contains int64) bool
- func ContainsInt8(slice []int8, contains int8) bool
- func ContainsObject(slice interface{}, contains interface{}) bool
- func ContainsString(slice []string, contains string) bool
- func ContainsUInt(slice []uint, contains uint) bool
- func ContainsUInt16(slice []uint16, contains uint16) bool
- func ContainsUInt32(slice []uint32, contains uint32) bool
- func ContainsUInt64(slice []uint64, contains uint64) bool
- func ContainsUInt8(slice []uint8, contains uint8) bool
- func MinusStrings(s, minus []string) []string
- func PlusStrings(s, plus []string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommonStrings ¶
CommonStrings gets a new []string that contains strings that are present in both specified slices.
func Contains ¶
func Contains(slice, contains interface{}) bool
Contains determines if the "contains" argument is contained within the "slice" argument. The slice argument must be a slice or array.
This function is performant for builtin types such as int, string, etc, though it is not quite as fast as a direct comparison loop would be, due to some type assertion necessary to make it generic.
If the type passed is not a builtin type, it is significantly slower due to deep equality checks.
This function is practically equal in performance to a a direct comparison loop for large arrays as the type assertion becomes a miniscule part of the overall time spent. For small arrays, it is about 7 times slower than using the equivalent direct call function.
If you need bleeding edge performance, use one of the direct functions provided.
func ContainsBool ¶
ContainsBool checks if the slice has the contains value in it.
func ContainsComplex128 ¶
func ContainsComplex128(slice []complex128, contains complex128) bool
ContainsComplex128 checks if the slice has the contains value in it.
func ContainsComplex64 ¶
ContainsComplex64 checks if the slice has the contains value in it.
func ContainsFloat32 ¶
ContainsFloat32 checks if the slice has the contains value in it.
func ContainsFloat64 ¶
ContainsFloat64 checks if the slice has the contains value in it.
func ContainsInt ¶
ContainsInt checks if the slice has the contains value in it.
func ContainsInt16 ¶
ContainsInt16 checks if the slice has the contains value in it.
func ContainsInt32 ¶
ContainsInt32 checks if the slice has the contains value in it.
func ContainsInt64 ¶
ContainsInt64 checks if the slice has the contains value in it.
func ContainsInt8 ¶
ContainsInt8 checks if the slice has the contains value in it.
func ContainsObject ¶
func ContainsObject(slice interface{}, contains interface{}) bool
ContainsObject checks if the slice has the contains value in it.
func ContainsString ¶
ContainsString checks if the slice has the contains value in it.
func ContainsUInt ¶
ContainsUInt checks if the slice has the contains value in it.
func ContainsUInt16 ¶
ContainsUInt16 checks if the slice has the contains value in it.
func ContainsUInt32 ¶
ContainsUInt32 checks if the slice has the contains value in it.
func ContainsUInt64 ¶
ContainsUInt64 checks if the slice has the contains value in it.
func ContainsUInt8 ¶
ContainsUInt8 checks if the slice has the contains value in it.
func MinusStrings ¶
MinusStrings gets a new []string containing all items in s, that no not appear in minus.
func PlusStrings ¶
PlusStrings adds two []string arrays together, returning a new []string.
Types ¶
This section is empty.