strslices

package
v0.68.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2025 License: MIT Imports: 3 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(s []string, v string) int

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

func ContainsIndex(s []string, substr string) int

ContainsIndex returns the index of the first match using `strings.Contains()`. Returns -1 if not found.

func ElementHasIndex

func ElementHasIndex(haystack []string, needle string, wantIndex int) bool

func Index

func Index(haystack []string, needle string, equalFold bool, caser *cases.Caser) int

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

func IndexMulti(s string, substr ...string) int

IndexMulti returns the earliest match.

func IndexValueOrDefault

func IndexValueOrDefault(s []string, index int, def string) string

IndexValueOrDefault returns the element at the index provided or the default string.

func SoSFilterLinesHaveIndex

func SoSFilterLinesHaveIndex(groups [][]string, needle string, wantIndex int) [][]string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL