Documentation
¶
Index ¶
- func BySplitLength(s []string, sep string) map[int][]string
- func ChooseOnePreferredLowerTrimSpace(options, preferenceOrder []string) string
- func Compare(sliceA, sliceB []string) ([]string, []string, []string)
- func CondenseAndQuote(s []string, trimLeft, trimRight, quoteLeft, quoteRight string) []string
- func CondenseAndQuoteSpace(s []string, quoteLeft, quoteRight string) []string
- func CondensePunctuation(s []string) []string
- func CondenseRegexps(s []string, regexps []*regexp.Regexp, replacement string) []string
- func CondenseSpace(elems []string, dedupeResults, sortResults bool) []string
- func Contains(s []string, v string) int
- func ContainsIndex(s []string, substr string) int
- func ElementHasIndex(haystack []string, needle string, wantIndex int) bool
- func Index(haystack []string, needle string, equalFold bool, caser *cases.Caser) int
- func IndexMore(haystack []string, needle string, trimSpace, toLower bool, ...) int
- func IndexMulti(s string, substr ...string) int
- func IndexValueOrDefault(s []string, index int, def string) string
- func Intersection(list1, list2 []string) []string
- func IntersectionCondenseSpace(slice1, slice2 []string) []string
- func IsEmpty(s []string, skipEmptyStrings bool) bool
- func JoinFunc(s []string, sep string, f func(string) string) string
- func Map(s []string, fn func(s string) string) []string
- func MatchAny(s1, s2 []string, caseInsensive, trimSpace bool) bool
- func OrderExplicit(s, order []string, inclUnordered bool) ([]string, []int)
- func SoSFilterLinesHaveIndex(groups [][]string, needle string, wantIndex int) [][]string
- func SplitLengthStats(s []string, sep string) map[int]int
- func Subtract(real, filter []string) []string
- func ToDoc(s []string, cfg map[string]int, trimSpace, inclEmpty bool) map[string]string
- func ToLower(s []string) []string
- func ToMap(s []string) map[string]int
- func ToSingleIntOrNeg(s []string) int
- func ToUpper(s []string) []string
- func Trim(elems []string, cutstr string, condense bool) []string
- func TrimSpace(elems []string, condense bool) []string
- type Strings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BySplitLength ¶ added in v0.68.7
dBySplitLength returns lines by split length. This is useful for analyzing what types of data exist with different lengths.
func ChooseOnePreferredLowerTrimSpace ¶ added in v0.68.7
func Compare ¶ added in v0.68.7
Compare returns 3 slices given 2 slices which represent intersection sets. The first set is present in slice A but not B, second for both and third present in slice B but not A.
func CondenseAndQuote ¶ added in v0.68.7
func CondenseAndQuoteSpace ¶ added in v0.68.7
func CondensePunctuation ¶ added in v0.68.7
func CondenseRegexps ¶ added in v0.68.7
func CondenseSpace ¶ added in v0.68.7
CondenseSpace trims space from lines and removes empty lines. `unique` dedupes lines and `sort` preforms a sort on the results.
func Contains ¶
Contains checks a slice of string to validate if individual string elements contain the supplied match string. A `1` is returned if all slice strings match, a `-1` is returned if no slices strings match, and a `0` is returned if more than one, but less than all slice strings match. An empty slice returns a `-1` as there are no members to match.
func ContainsIndex ¶
ContainsIndex returns the index of the first match using `strings.Contains()`. Returns -1 if not found.
func Index ¶
Index returns the index of the first match using `=`. Returns -1 if not found. if `equalFold` is selected and `caser` is `nil`, the default caser will be used.
func IndexMore ¶
func IndexMore(haystack []string, needle string, trimSpace, toLower bool, matchType stringsutil.MatchType) int
IndexMore returns the index of an element in a string slice. Returns -1 if not found.
func IndexMulti ¶
IndexMulti returns the earliest match.
func IndexValueOrDefault ¶
IndexValueOrDefault returns the element at the index provided or the default string.
func Intersection ¶ added in v0.68.7
func IntersectionCondenseSpace ¶ added in v0.68.7
func IsEmpty ¶ added in v0.68.7
IsEmpty checks to see if a slice is empty. If `skipEmptyStrings` it will also return empty if all elements are empty strings or only contain spaces.
func JoinFunc ¶ added in v0.68.7
JoinFunc joins a slice passing each elemen through the supplied function `f`.
func OrderExplicit ¶ added in v0.68.7
OrderExplicit reoders the values of a slice using a requested input order where the output is ordered by the requested order, minus missing requests, and followed by non-ordered items. In addition to the output slide, an output slice of index locations is also provided.
func SoSFilterLinesHaveIndex ¶
func SplitLengthStats ¶ added in v0.68.7
SplitLengthStats returns a `map[int]int` indicating how many strings of which length are present.
func ToDoc ¶ added in v0.68.7
ToDoc converts a slice to a map, trimming the values if desired. The `cfg` keys are the document property names or keys and the values are the index location of the slice.
func ToMap ¶ added in v0.68.7
ToMap returns the slide where the slice elements are the keys of the map, and the value is the number of times it appears.
func ToSingleIntOrNeg ¶ added in v0.68.7
ToSingleIntOrNeg converts a single element slice with a string to an integer or `-1`