Documentation
¶
Overview ¶
Package stringslice provides some utilities on top of []string for lazy developers.
Index ¶
- func Filter(slice []string, match MatchFunc) []string
- func Map(slice []string, mapping ...MapFunc) []string
- func MatchAll(slice []string, match MatchFunc) bool
- func MatchAny(slice []string, match MatchFunc) bool
- type MapFunc
- func AddPrefix(prefix string) MapFunc
- func AddSuffix(suffix string) MapFunc
- func Repeat(count int) MapFunc
- func Replace(old, new string, n int) MapFunc
- func ReplaceAll(old, new string) MapFunc
- func ToLowerSpecial(c unicode.SpecialCase) MapFunc
- func ToTitleSpecial(c unicode.SpecialCase) MapFunc
- func ToUpperSpecial(c unicode.SpecialCase) MapFunc
- func Trim(cutset string) MapFunc
- func TrimFunc(f func(rune) bool) MapFunc
- func TrimLeft(cutset string) MapFunc
- func TrimLeftFunc(f func(rune) bool) MapFunc
- func TrimPrefix(prefix string) MapFunc
- func TrimRight(cutset string) MapFunc
- func TrimRightFunc(f func(rune) bool) MapFunc
- func TrimSuffix(suffix string) MapFunc
- type MatchFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MapFunc ¶
MapFunc is a function that maps a string to a string.
func Repeat ¶
Repeat returns a map function that calls strings.Repeat With the element and the given argument.
func Replace ¶
Replace returns a map function that calls strings.Replace With the element and the given argument.
func ReplaceAll ¶
ReplaceAll returns a map function that calls strings.ReplaceAll With the element and the given argument.
func ToLowerSpecial ¶
func ToLowerSpecial(c unicode.SpecialCase) MapFunc
ToLowerSpecial returns a map function that calls strings.ToLowerSpecial With the element and the given argument.
func ToTitleSpecial ¶
func ToTitleSpecial(c unicode.SpecialCase) MapFunc
ToTitleSpecial returns a map function that calls strings.ToTitleSpecial With the element and the given argument.
func ToUpperSpecial ¶
func ToUpperSpecial(c unicode.SpecialCase) MapFunc
ToUpperSpecial returns a map function that calls strings.ToUpperSpecial With the element and the given argument.
func Trim ¶
Trim returns a map function that calls strings.Trim With the element and the given argument.
func TrimFunc ¶
TrimFunc returns a map function that calls strings.TrimFunc With the element and the given argument.
func TrimLeft ¶
TrimLeft returns a map function that calls strings.TrimLeft With the element and the given argument.
func TrimLeftFunc ¶
TrimLeftFunc returns a map function that calls strings.TrimLeftFunc With the element and the given argument.
func TrimPrefix ¶
TrimPrefix returns a map function that calls strings.TrimPrefix With the element and the given argument.
func TrimRight ¶
TrimRight returns a map function that calls strings.TrimRight With the element and the given argument.
func TrimRightFunc ¶
TrimRightFunc returns a map function that calls strings.TrimRightFunc With the element and the given argument.
func TrimSuffix ¶
TrimSuffix returns a map function that calls strings.TrimSuffix With the element and the given argument.
type MatchFunc ¶
MatchFunc is a function that matches elements in a string slice.
func Contains ¶
Contains returns a filter function that calls strings.Contains with the element and the given argument.
func ContainsAny ¶
ContainsAny returns a filter function that calls strings.ContainsAny with the element and the given argument.
func ContainsRune ¶
ContainsRune returns a filter function that calls strings.ContainsRune with the element and the given argument.
func Equal ¶
Equal returns a filter function that returns true if the element equals the given argument.
func EqualFold ¶
EqualFold returns a filter function that calls strings.EqualFold with the element and the given argument.
func HasPrefix ¶
HasPrefix returns a filter function that calls strings.HasPrefix with the element and the given argument.