zstrings

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInterfaceNotString = errors.New("encountered non-string interface")
)

Functions

func As

func As(slice []interface{}) (res []string, err error)

Convert a []interface{} slice into []string slice if possible

func Contains

func Contains(haystack []string, needle string) bool

Check if a slice ([]string) contains a matching member

func ContainsAll

func ContainsAll(haystack []string, needles ...string) bool

Check if a []string slice contains ALL of the provided members

func ContainsAny

func ContainsAny(haystack []string, needles ...string) bool

Check if a []string slice contains ANY of the provided members

func Cut

func Cut(slice []string, separator string) (left, right []string, found bool)

Cut the slice into two slices separated by the separator

func CutAny

func CutAny(val []string, seperators ...string) (left, right []string, found bool)

Cut the slice into two slices separated by the first separator

func Equal

func Equal(a []string, b []string) bool

func Index

func Index(haystack []string, needle string) int

Find the index where the needle appears. Returns -1 if the needle doesn't appear in the slice.

func Interface

func Interface(slice []string) (res []interface{}, err error)

Convert a []string slice into a slice of interfaces ([]interface{})

func Split

func Split(slice []string, separator string) (parts [][]string)

Split the slice into one or more slices separated by the separator

Types

This section is empty.

Jump to

Keyboard shortcuts

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