package stringutils
import "github.com/docker/cli/components/engine/pkg/stringutils"
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 ShellQuoteArguments(args []string) string
- func Truncate(s string, maxlen int) string
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 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
func Truncate ¶
Truncate truncates a string to maxlen.
Source Files ¶
- Version
- v17.10.0-ce-rc1+incompatible
- Published
- Oct 4, 2017
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 3 seconds ago –
Tools for package owners.