package stringutils
import "github.com/docker/docker/pkg/stringutils"
Package stringutils provides helper functions for dealing with strings.
Index ¶
- 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
- type StrSlice
Functions ¶
func GenerateRandomASCIIString ¶
GenerateRandomASCIIString generates an ASCII random stirng 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 an program via a shell
func Truncate ¶
Truncate truncates a string to maxlen.
Types ¶
type StrSlice ¶
type StrSlice struct {
// contains filtered or unexported fields
}
StrSlice representes a string or an array of strings. We need to override the json decoder to accept both options.
func NewStrSlice ¶
NewStrSlice creates an StrSlice based on the specified parts (as strings).
func (*StrSlice) Len ¶
Len returns the number of parts of the StrSlice.
func (*StrSlice) MarshalJSON ¶
MarshalJSON Marshals (or serializes) the StrSlice into the json format. This method is needed to implement json.Marshaller.
func (*StrSlice) Slice ¶
Slice gets the parts of the StrSlice as a Slice of string.
func (*StrSlice) ToString ¶
ToString gets space separated string of all the parts.
func (*StrSlice) UnmarshalJSON ¶
UnmarshalJSON decodes the byte slice whether it's a string or an array of strings. This method is needed to implement json.Unmarshaler.
Source Files ¶
- Version
- v1.9.0-rc2
- Published
- Oct 22, 2015
- Platform
- js/wasm
- Imports
- 5 packages
- Last checked
- 19 minutes ago –
Tools for package owners.