stringutil

package
v0.77.2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasAnyOfPrefixes

func HasAnyOfPrefixes(input string, prefixes ...string) bool

HasAnyOfPrefixes returns an indication if the given string has any of the given prefixes.

func HasAnyOfSuffixes

func HasAnyOfSuffixes(input string, suffixes ...string) bool

HasAnyOfSuffixes returns an indication if the given string has any of the given suffixes.

func MatchCaptureGroups

func MatchCaptureGroups(regEx *regexp.Regexp, str string) map[string]string

MatchCaptureGroups takes a regular expression and string and returns all of the named capture group results in a map.

func SplitCommaSeparatedString added in v0.72.0

func SplitCommaSeparatedString(input string) []string

SplitCommaSeparatedString returns a slice of strings separated from the input string by commas

func Tprintf

func Tprintf(tmpl string, data map[string]interface{}) string

Tprintf renders a string from a given template string and field values

Types

type Color

type Color uint8
const (
	DefaultColor Color = iota + 30
	Red
	Green
	Yellow
	Blue
	Magenta
	Cyan
	White
)

func (Color) Format

func (c Color) Format(s string) string

TODO: not cross platform (windows...)

type StringSet

type StringSet map[string]struct{}

func NewStringSet

func NewStringSet() StringSet

func NewStringSetFromSlice

func NewStringSetFromSlice(start []string) StringSet

func (StringSet) Add

func (s StringSet) Add(i string)

func (StringSet) Contains

func (s StringSet) Contains(i string) bool

func (StringSet) Remove

func (s StringSet) Remove(i string)

func (StringSet) ToSlice

func (s StringSet) ToSlice() []string

Jump to

Keyboard shortcuts

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