Documentation ¶
Overview ¶
Package stringutils provides helper functions for dealing with strings.
Index ¶
- func Ellipsis(s string, maxlen int) string
- func GenerateRandomASCIIString(n int) string
- func GenerateRandomAlphaOnlyString(n int) string
- func InSlice(slice []string, s string) bool
- func RemoveFromSlice(slice []string, s string) (ret []string)
- func ShellQuoteArguments(args []string) string
- func Truncate(s string, maxlen int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ellipsis ¶
Ellipsis truncates a string to fit within maxlen, and appends ellipsis (...). For maxlen of 3 and lower, no ellipsis is appended.
func GenerateRandomASCIIString ¶
GenerateRandomASCIIString generates an ASCII random string with length n.
func GenerateRandomAlphaOnlyString ¶
GenerateRandomAlphaOnlyString generates an alphabetical random string with length n.
func InSlice ¶
InSlice tests whether a string is contained in a slice of strings or not. Comparison is case insensitive
func RemoveFromSlice ¶ added in v0.46.1
RemoveFromSlice removes a string from a slice. The string can be present multiple times. The entire slice is iterated.
func ShellQuoteArguments ¶
ShellQuoteArguments takes a list of strings and escapes them so they will be handled right when passed as arguments to a program via a shell
Types ¶
This section is empty.