Documentation
¶
Overview ¶
Package stringutil provides advanced string manipulation functions, including ANSI scrubbing, credential masking, and random string generation.
Index ¶
- func NamedGroupMatches(s string, re *regexp.Regexp) (map[string][]string, []string)
- func ProcessParamsAndQuotes(args []string) []string
- func RandomAlphanumeric(n int) string
- func ScrubANSICodes(input string) string
- func ScrubCredentials(s string) string
- func ScrubCredentialsAll(s string) string
- func StrOrDefault(str, defaultStr string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NamedGroupMatches ¶
NamedGroupMatches returns a map with all found named regex groups as keys and an array of all matches as the value and an array of all the keys in the order they were set in the regex (this is since the map keys order won't be predictable).
func ProcessParamsAndQuotes ¶
ProcessParamsAndQuotes takes in a slice of strings, and rearranges the slices depending on quotes and parenthesis.
For example "hello ", "wor(", "ld)" becomes "hello ", "wor( ld)".
func RandomAlphanumeric ¶
RandomAlphanumeric returns a random alphanumeric string of length n.
func ScrubANSICodes ¶
ScrubANSICodes removes ANSI escape codes from a string.
func ScrubCredentials ¶
ScrubCredentials removes credentials from a string.
func ScrubCredentialsAll ¶
ScrubCredentialsAll scrubs all credentials from a longer piece of text.
func StrOrDefault ¶
StrOrDefault returns str or defaultStr when str is empty.
Types ¶
This section is empty.