Documentation ¶
Overview ¶
Package slice provides a set of functions around slices.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsAll ¶
ContainsAll return true if a string slice contains all elements of another string slice, otherwise returns false.
Types ¶
type StringSlice ¶
type StringSlice []string
StringSlice wraps a string slice to provide methods on top of it
func (StringSlice) Contains ¶ added in v1.2.0
func (ss StringSlice) Contains(s string) bool
Contains returns true if the given string value is found in the provided slice, otherwise returns false.
func (StringSlice) IsEmpty ¶ added in v1.2.0
func (ss StringSlice) IsEmpty() bool
IsEmpty returns true if a string slice is empty or contains empty string values, otherwise returns false.
func (StringSlice) ToCommaSeparatedString ¶ added in v1.2.0
func (ss StringSlice) ToCommaSeparatedString() string
ToCommaSeparatedString returns the elements of the string slice as a single string where all values are separated by the comma.
func (StringSlice) ToMap ¶
func (ss StringSlice) ToMap(sep string) map[string]string
ToMap iterates over the slice and slices each element into substrings separated by sep. Then it adds a map key value pair where the key is the first substring and value is the second substring
If the sep is not found in the slice element then it's ignored ¶
It returns the produced map after iterating all slice elements