Documentation
¶
Overview ¶
Package slices provides additional slice functions on common slice types
Index ¶
- func BoolSlicesEqual(a, b []bool) bool
- func ByteSlicesEqual(a, b []byte) bool
- func CloneStrings(src []string) []string
- func ContainsString(items []string, item string) bool
- func ContainsStringEqualFold(items []string, item string) bool
- func Float64SlicesEqual(a, b []float64) bool
- func Int64SlicesEqual(a, b []int64) bool
- func MapStringSlice(items []string, mapFn func(in string) string) []string
- func NvlInt(items ...int) int
- func NvlInt64(items ...int64) int64
- func NvlString(items ...string) string
- func NvlUint64(items ...uint64) uint64
- func Prefixed(prefix string, items []string) []string
- func Quoted(items []string) []string
- func StringContainsOneOf(item string, items []string) bool
- func StringSlicesEqual(a, b []string) bool
- func Suffixed(suffix string, items []string) []string
- func Uint64SlicesEqual(a, b []uint64) bool
- type Uint64s
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolSlicesEqual ¶
BoolSlicesEqual returns true only if the contents of the 2 slices are the same
func ByteSlicesEqual ¶
ByteSlicesEqual returns true only if the contents of the 2 slices are the same
func CloneStrings ¶
CloneStrings will return an independnt copy of the src slice, it preserves the distinction between a nil value and an empty slice.
func ContainsString ¶
ContainsString returns true if the items slice contains a value equal to item Note that this can end up traversing the entire slice, and so is only really suitable for small slices, for larger data sets, consider using a map instead.
func ContainsStringEqualFold ¶
ContainsStringEqualFold returns true if the items slice contains a value equal to item ignoring case [i.e. using EqualFold] Note that this can end up traversing the entire slice, and so is only really suitable for small slices, for larger data sets, consider using a map instead.
func Float64SlicesEqual ¶
Float64SlicesEqual returns true only if the contents of the 2 slices are the same
func Int64SlicesEqual ¶
Int64SlicesEqual returns true only if the contents of the 2 slices are the same
func MapStringSlice ¶
MapStringSlice returns a new slices of strings that is the result of applies mapFn to each string in the input slice.
func NvlInt ¶
NvlInt returns the first value from the supplied list that is not 0, or 0 if there are no values that are not zero
func NvlInt64 ¶
NvlInt64 returns the first value from the supplied list that is not 0, or 0 if there are no values that are not zero
func NvlString ¶
NvlString returns the first string from the supplied list that has len() > 0 or "" if all the strings are empty
func NvlUint64 ¶
NvlUint64 returns the first item from the list that is not 0, or 0 if there are no values that are not zero
func Prefixed ¶
Prefixed returns a new slice of strings with each input item prefixed by the supplied prefix e.g. Prefixed("foo", []string{"bar","bob"}) would return []string{"foobar", "foobob"} the input slice is not modified.
func Quoted ¶
Quoted returns a new slice of strings where each input stream has been wrapped in quotes
func StringContainsOneOf ¶
StringContainsOneOf returns true if one of items slice is a substring of specified value.
func StringSlicesEqual ¶
StringSlicesEqual returns true only if the contents of the 2 slices are the same
func Suffixed ¶
Suffixed returns a new slice of strings which each input item suffixed by the supplied suffix e.g. Suffixed("foo", []string{"bar","bob"}) would return []string{"barfoo", "bobfoo"} the input slice is not modified
func Uint64SlicesEqual ¶
Uint64SlicesEqual returns true only if the contents of the 2 slices are the same
Types ¶
type Uint64s ¶
type Uint64s []uint64
Uint64s is a slice of uint64, that knows how to be sorted, using sort.Sort