stringslice

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromString added in v0.19.0

func FromString(s string, sep string) []string

FromString converts a string to a slice of strings, splitting on the sep character. Unlike strings.Split, this function will also trim whitespace from the resulting strings.

func StrAppendUnique

func StrAppendUnique(vs []string, toAdd string) []string

StrAppendUnique appends toAdd to the vs string slice if toAdd does not already exist in the slice. It returns the new or unchanged string slice.

func StrAppendUniques

func StrAppendUniques(vs []string, toAdd []string) []string

StrAppendUniques appends a slice of string values to the vs string slice. It only appends values that do not already exist in the slice. It returns the new or unchanged string slice.

func StrDelete

func StrDelete(vs []string, toDel string) []string

StrDelete returns the vs string slice with toDel values removed.

func StrExclude added in v0.19.0

func StrExclude(vs []string, toExclude []string) []string

StrExclude removes all instances of any value in toExclude from the vs string slice. It returns the new or unchanged string slice.

func StrFilter

func StrFilter(vs []string, f func(string) bool) []string

func StrInclude

func StrInclude(vs []string, t string) bool

func StrIndex

func StrIndex(vs []string, t string) int

func StrMap

func StrMap(vs []string, f func(string) string) []string

func StrUnique

func StrUnique(vs []string) []string

StrUnique returns the vs string slice with non-unique values removed.

func StringSliceToIntSlice

func StringSliceToIntSlice(ss []string) ([]int, error)

StringSliceToIntSlice converts a slice of strings to a slice of ints. Returns an error if any values cannot be parsed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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