Documentation ¶
Index ¶
- Variables
- func CheckMark() string
- func DiffSlices(oldSlice []string, newSlice []string) ([]string, []string)
- func EnsureStringArrayContains(slice []string, token string) []string
- func ExtractKeyValuePairs(values []string, sep string) (map[string]string, error)
- func FirstNotEmptyString(values ...string) string
- func HasPrefix(text string, prefixes ...string) bool
- func HasSuffix(text string, suffixes ...string) bool
- func IsValidUrl(s string) bool
- func ParseBool(text string) (bool, error)
- func RandStringBytesMaskImprSrc(n int) (string, error)
- func RegexpSplit(text string, regexSeperator string) []string
- func RemoveStringFromSlice(strings []string, toRemove string) []string
- func ReplaceAllStringSubmatchFunc(re *regexp.Regexp, str string, repl func(groups []Group) []string) string
- func ReverseStrings(a []string)
- func SanitizeURL(unsanitizedUrl string) string
- func SortedMapKeys(m map[string]string) []string
- func StringArrayHasPrefixIndex(array []string, prefix string) int
- func StringArrayIndex(array []string, value string) int
- func StringArrayToLower(values []string) []string
- func StringArraysEqual(a1 []string, a2 []string) bool
- func StringContainsAny(text string, includes []string, excludes []string) bool
- func StringIndexes(text string, value string) []int
- func StringMatchesAny(text string, includes []string, excludes []string) bool
- func StringMatchesPattern(text string, pattern string) bool
- func StringsContaining(slice []string, filter string) []string
- func StripTrailingSlash(url string) string
- func ToCamelCase(s string) string
- func URLSetUserPassword(rawURL, username, password string) (string, error)
- func URLToHostName(svcURL string) string
- func UrlEqual(url1, url2 string) bool
- func UrlHostNameWithoutPort(rawUri string) (string, error)
- func UrlJoin(paths ...string) string
- func YesNo(t bool) string
- type Group
Constants ¶
This section is empty.
Variables ¶
var DisallowedLabelCharacters = regexp.MustCompile("[^a-z0-9-]")
DisallowedLabelCharacters regex of chars not allowed in lables
Functions ¶
func CheckMark ¶
func CheckMark() string
CheckMark returns the check mark unicode character. We could configure this to use no color or avoid unicode using platform, env vars or config?
func DiffSlices ¶
DiffSlices compares the two slices and returns an array of items to delete from the old slice and a slice of new values to add to
func EnsureStringArrayContains ¶ added in v3.2.15
EnsureStringArrayContains appends token to slice if token isn't already in slice
func ExtractKeyValuePairs ¶
ExtractKeyValuePairs creates a map of an string array assuming that each array element is of the form <key><sep><value>. An error is returned is a array element cannot be split into a key/value pair using the specified separator.
func FirstNotEmptyString ¶
FirstNotEmptyString returns the first non empty string or the empty string if none can be found
func IsValidUrl ¶
IsValidUrl tests a string to determine if it is a well-structured url or not.
func RandStringBytesMaskImprSrc ¶
RandStringBytesMaskImprSrc returns a random hexadecimal string of length n.
func RegexpSplit ¶
RegexpSplit splits a string into an array using the regexSep as a separator
func RemoveStringFromSlice ¶
RemoveStringFromSlice removes the first occurrence of the specified string from a slice, if it exists and returns the result
func ReplaceAllStringSubmatchFunc ¶
func ReplaceAllStringSubmatchFunc(re *regexp.Regexp, str string, repl func(groups []Group) []string) string
ReplaceAllStringSubmatchFunc will replace all the submatches found in str by re by calling repl and replacing each submatch with the result. Both the argument and the result of repl ignore the entire match (i.e. the item at index 0 is the first submatch)
func ReverseStrings ¶
func ReverseStrings(a []string)
func SanitizeURL ¶
SanitizeURL sanitizes by stripping the user and password
func SortedMapKeys ¶
SortedMapKeys returns the sorted keys of the given map
func StringArrayHasPrefixIndex ¶
StringArrayHasPrefixIndex returns the index in the slice which the value has the given prefix
func StringArrayIndex ¶
StringArrayIndex returns the index in the slice which equals the given value
func StringArrayToLower ¶
StringArrayToLower returns a string slice with all the values converted to lower case
func StringArraysEqual ¶
StringArraysEqual returns true if the two string slices are equal
func StringContainsAny ¶
StringContainsAny returns true if the given text contains the includes/excludes lists
func StringIndexes ¶
StringIndexes returns all the indices where the value occurs in the given string
func StringMatchesAny ¶
StringMatchesAny returns true if the given text matches the includes/excludes lists
func StringMatchesPattern ¶
StringMatchesPattern returns true if the given text matches the includes/excludes lists
func StringsContaining ¶
StringsContaining if the filter is not empty return all the strings which contain the text
func StripTrailingSlash ¶
StripTrailingSlash removes any trailing forward slashes on the URL
func ToCamelCase ¶
ToCamelCase turn "my-super-name" into "MySuperName" Usefule for creating valid go-template variable names
func URLSetUserPassword ¶
URLSetUserPassword adds the user and password to the URL
func URLToHostName ¶
URLToHostName converts the given URL to a host name returning the error string if its not a URL
func UrlHostNameWithoutPort ¶
UrlHostNameWithoutPort returns the host name without any port of the given URL like string