stringutil

package
v0.8.19-rc-0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package stringutil provides advanced string manipulation functions, including ANSI scrubbing, credential masking, and random string generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NamedGroupMatches

func NamedGroupMatches(s string, re *regexp.Regexp) (map[string][]string, []string)

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

func ProcessParamsAndQuotes(args []string) []string

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

func RandomAlphanumeric(n int) string

RandomAlphanumeric returns a random alphanumeric string of length n.

func ScrubANSICodes

func ScrubANSICodes(input string) string

ScrubANSICodes removes ANSI escape codes from a string.

func ScrubCredentials

func ScrubCredentials(s string) string

ScrubCredentials removes credentials from a string.

func ScrubCredentialsAll

func ScrubCredentialsAll(s string) string

ScrubCredentialsAll scrubs all credentials from a longer piece of text.

Types

This section is empty.

Jump to

Keyboard shortcuts

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