Documentation ¶
Index ¶
- Variables
- func BoolToYesNo(val bool) string
- func Capitalize(s string) string
- func Concat(args []string, separator string) string
- func ConcatP(args ...*string) string
- func Equal(a string, b string) bool
- func Float64ToString(number float64, precision int) string
- func Float64ToStringWithPrec(number float64, prec int) string
- func FormatCurrency(amount float64, currencySymbol string, formatZero bool) string
- func HTMLStringToTextBytes(html string) ([]byte, error)
- func HTMLStringToTextString(html string) (string, error)
- func HumanReadableToKey(s string, separator string) string
- func Int64SliceToString(numbers []int64) string
- func Int64SliceToStringSlice(numbers []int64) []string
- func Int64ToString(number int64) string
- func IntToString(number int) string
- func IsAllDigits(str string) bool
- func IsAlphaNumeric(str string) bool
- func IsAlphaNumericOrDash(str string) bool
- func IsEmpty(sp *string) bool
- func IsNumericString(s string) bool
- func IsSnakeCase(name string) bool
- func KeyToHumanReadable(s string) string
- func LimitStringToMaxLength(str string, maxLen int) string
- func PascalCaseToSentence(pascal string) string
- func PrettyJSON(jsonString string) (validJson bool, prettyString string)
- func RemoveAllWhiteSpaces(s string) string
- func ReplaceAllRegexStringSubmatch(re *regexp.Regexp, s string, replaceWith string) string
- func ReplaceCaseInsensitive(string, toReplace, replaceWith string) string
- func ReplaceNonSpacingMarks(str string) string
- func SentenceCase(str string) string
- func SnakeToKebabString(s string) string
- func SplitString(str string, sep []rune) []string
- func StringContainsNumbers(s string) bool
- func StringContainsOnlyNumbers(s string) bool
- func StringTrimQuotes(stringToTrim string) string
- func ToJSONString(object interface{}) (string, error)
- func TrimAndToLower(s string) string
- func TrimP(sp *string) *string
- func TrimQuotes(stringToTrim string) string
- func TrimSpaceForPointer(s *string) *string
- func ValidateStringAsInt64(stringValue string) error
- type KeyReader
Constants ¶
This section is empty.
Variables ¶
var NonOfficialWhitespaceChars = []string{
"\u180E",
"\u200B",
"\u200C",
"\u200D",
"\u200E",
"\u2060",
"\u202C",
"\uFEFF",
"\u00AD",
}
var WhitespaceChars = []string{
"\u0009",
"\u000A",
"\u000B",
"\u000C",
"\u000D",
"\u0020",
"\u0085",
"\u00A0",
"\u1680",
"\u2000",
"\u2001",
"\u2002",
"\u2003",
"\u2004",
"\u2005",
"\u2006",
"\u2007",
"\u2008",
"\u2009",
"\u200A",
"\u2028",
"\u2029",
"\u202F",
"\u205F",
"\u3000",
}
Functions ¶
func BoolToYesNo ¶ added in v1.233.0
func Capitalize ¶ added in v1.130.0
func Concat ¶ added in v1.111.0
Concat concatenates all specified non-empty strings with ", " separators
func Float64ToString ¶
func Float64ToStringWithPrec ¶
func FormatCurrency ¶ added in v1.233.0
func HTMLStringToTextBytes ¶ added in v1.205.0
func HTMLStringToTextString ¶ added in v1.205.0
func HumanReadableToKey ¶ added in v1.148.0
func Int64SliceToString ¶
func Int64SliceToStringSlice ¶
func Int64ToString ¶
func IntToString ¶
func IsAllDigits ¶ added in v1.233.0
func IsAlphaNumeric ¶
func IsAlphaNumericOrDash ¶
func IsNumericString ¶
IsNumericString returns true if the string can be converted to a float without error
func IsSnakeCase ¶
func KeyToHumanReadable ¶
func LimitStringToMaxLength ¶
func PascalCaseToSentence ¶
func PrettyJSON ¶ added in v1.101.0
func RemoveAllWhiteSpaces ¶
func ReplaceAllRegexStringSubmatch ¶ added in v1.169.0
ReplaceAllRegexStringSubmatch finds the submatches for a regular expression that has a single capturing group and replaces all the submatches (i.e. the part that matches the capturing group) with replaceWith. E.g. the regular expression re = a(x*)b captures any number of x's that are between an a and b. ReplaceAllRegexStringSubmatch(re, "-axxb-ab-axb-x-ax-xb-ba-", "?") will result in "-a?b-a?b-a?b-x-ax-xb-ba-"
func ReplaceCaseInsensitive ¶
func ReplaceNonSpacingMarks ¶
ReplaceNonSpacingMarks removes diacritics e.g. êžů becomes ezu
func SentenceCase ¶
func SnakeToKebabString ¶
func SplitString ¶
SplitString separates a string on any character in the list of sep
func StringContainsNumbers ¶ added in v1.201.0
func StringContainsOnlyNumbers ¶ added in v1.201.0
func StringTrimQuotes ¶
StringTrimQuotes - trims quotes from a string (ie: "foo" will return foo)
func ToJSONString ¶
func TrimAndToLower ¶ added in v1.199.0
TrimAndToLower trims the whitespace from a string and converts it to lowercase
func TrimQuotes ¶
TrimQuotes - trims quotes from a string (ie: "foo" will return foo)
func TrimSpaceForPointer ¶ added in v1.151.0
func ValidateStringAsInt64 ¶
Types ¶
type KeyReader ¶
type KeyReader interface { Keys(prefix string) []string GetString(key string) (value string, ok bool) }
KeyReader is an interface to read string "<key>":"<value>" pairs which is common to read from the environment it is abstracted so the same interface can be implemented for reading for example from REDIS and other sources
func EnvironmentKeyReader ¶
func EnvironmentKeyReader() KeyReader