Documentation
¶
Overview ¶
Package stringUtils provides various string utilities.
Index ¶
- func Abbreviate(str string, maxWidth int) string
- func AbbreviateWithOffset(str string, offset int, maxWidth int) string
- func AppendIfMissing(str string, suffix string, suffixes ...string) string
- func AppendIfMissingIgnoreCase(str string, suffix string, suffixes ...string) string
- func Capitalize(str string) string
- func Chomp(str string) string
- func Chop(str string) string
- func Contains(str string, search string) bool
- func ContainsAny(str string, search ...string) bool
- func ContainsAnyCharacter(str string, search string) bool
- func ContainsIgnoreCase(str string, search string) bool
- func ContainsNone(str string, search ...string) bool
- func ContainsNoneCharacter(str string, search string) bool
- func ContainsOnly(str string, search ...string) bool
- func DefaultString(str string, defaultStr string) string
- func EndsWith(str string, suffix string) bool
- func EndsWithAny(str string, suffixes ...string) bool
- func EndsWithAnyIgnoreCase(str string, suffixes ...string) bool
- func EndsWithIgnoreCase(str string, suffix string) bool
- func IsAllLowerCase(str string) bool
- func IsAllUpperCase(str string) bool
- func IsAlpha(str string) bool
- func IsAlphaSpace(str string) bool
- func IsAlphanumeric(str string) bool
- func IsAlphanumericSpace(str string) bool
- func IsAnyBlank(strings ...string) bool
- func IsAnyEmpty(strings ...string) bool
- func IsBlank(s string) bool
- func IsEmpty(s string) bool
- func IsNoneBlank(strings ...string) bool
- func IsNoneEmpty(strings ...string) bool
- func IsNotBlank(s string) bool
- func IsNotEmpty(s string) bool
- func IsNumeric(str string) bool
- func IsNumericSpace(str string) bool
- func IsWhitespace(str string) bool
- func Join(a []string, sep string) string
- func JoinBool(a []bool, sep string) string
- func JoinFloat64(a []float64, sep string) string
- func JoinFloat64WithFormatAndPrecision(a []float64, fmt byte, precision int, sep string) string
- func JoinInt(a []int, sep string) string
- func JoinInt64(a []int64, sep string) string
- func JoinUint64(ints []uint64, sep string) string
- func Left(str string, size int) string
- func LowerCase(str string) string
- func Mid(str string, pos int, size int) string
- func Overlay(str string, overlay string, start int, end int) string
- func PrependIfMissing(str string, prefix string, prefixes ...string) string
- func PrependIfMissingIgnoreCase(str string, prefix string, prefixes ...string) string
- func Remove(str string, remove string) string
- func RemoveEnd(str string, remove string) string
- func RemoveEndIgnoreCase(str string, remove string) string
- func RemovePattern(str string, pattern string) string
- func RemoveStart(str string, remove string) string
- func RemoveStartIgnoreCase(str string, remove string) string
- func Repeat(str string, repeat int) string
- func RepeatWithSeparator(str string, sep string, repeat int) string
- func Reverse(s string) string
- func ReverseDelimited(str string, del string) string
- func Right(str string, size int) string
- func StartsWith(str string, prefix string) bool
- func StartsWithAny(str string, prefixes ...string) bool
- func StartsWithAnyIgnoreCase(str string, prefixes ...string) bool
- func StartsWithIgnoreCase(str string, prefix string) bool
- func Strip(str string) string
- func StripEnd(str string) string
- func StripStart(str string) string
- func SubstringAfter(str string, sep string) string
- func SubstringAfterLast(str string, sep string) string
- func SubstringBefore(str string, sep string) string
- func SubstringBeforeLast(str string, sep string) string
- func SwapCase(str string) string
- func Trim(str string) string
- func Uncapitalize(str string) string
- func UpperCase(str string) string
- func Wrap(str string, wrapWith string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Abbreviate ¶
Abbreviate abbreviates a string using ellipses.
func AbbreviateWithOffset ¶
AbbreviateWithOffset abbreviates a string using ellipses at a specific offset.
func AppendIfMissing ¶
AppendIfMissing appends a suffix to a string if missing.
func AppendIfMissingIgnoreCase ¶
AppendIfMissingIgnoreCase appends a suffix to a string if missing (ignoring case).
func Capitalize ¶
Capitalize capitalizes a string changing the first letter to title case. No other letters are changed.
func Chomp ¶
Chomp removes one newline from end of a string if it's there, otherwise leave it alone. A newline is "\n", "\r", or "\r\n".
func Chop ¶
Chop removes the last character from a string. If the string ends in \r\n, then remove both of them.
func ContainsAny ¶
ContainsAny checks if the string contains any of the string in the given array.
func ContainsAnyCharacter ¶
ContainsAnyCharacter checks if the string contains any of the character in the given string.
func ContainsIgnoreCase ¶
ContainsIgnoreCase checks if the string contains the searched string ignoring case.
func ContainsNone ¶
ContainsNone checks if the string contains no occurrence of searched string.
func ContainsNoneCharacter ¶
ContainsNoneCharacter checks if the string contains no occurrence of searched string.
func ContainsOnly ¶
ContainsOnly checks if a string contains only some strings.
func DefaultString ¶
Returns either the passed in String, or if the String is Empty, the value of defaultStr.
func EndsWithAny ¶
EndsWithAny check if a string ends with any of an array of specified strings.
func EndsWithAnyIgnoreCase ¶
EndsWithAnyIgnoreCase check if a string ends with any of an array of specified strings (ignoring case).
func EndsWithIgnoreCase ¶
EndsWithIgnoreCase case insensitive check if a string ends with a specified suffix.
func IsAllLowerCase ¶
IsAllLowerCase checks if the string contains only lowercase characters.
func IsAllUpperCase ¶
IsAllUpperCase checks if the string contains only uppercase characters.
func IsAlphaSpace ¶
IsAlphaSpace checks if the string contains only Unicode letters and spaces.
func IsAlphanumeric ¶
IsAlphanumeric checks if the string contains only Unicode letters and digits.
func IsAlphanumericSpace ¶
IsAlphanumericSpace checks if the string contains only Unicode letters, digits and spaces.
func IsAnyBlank ¶
IsAnyBlank checks if any one of the strings are empty or containing only whitespaces.
func IsAnyEmpty ¶
IsAnyEmpty checks if any one of the given strings are empty.
func IsNoneBlank ¶
IsNoneBlank checks if none of the strings are empty or containing only whitespaces.
func IsNoneEmpty ¶
IsNoneEmpty checks if none of the strings are empty.
func IsNotBlank ¶
IsNotBlank checks if a string is not empty or containing only whitespaces.
func IsNumericSpace ¶
IsNumericSpace checks if the string contains only digits and whitespace.
func IsWhitespace ¶
IsWhitespace checks if the string contains only whitespace.
func Join ¶
Join joins an array of strings into a string where each item of the array is separated with a separator.
func JoinFloat64 ¶
JoinFloat64 is the same as Join but joining float64. The default format given to strconv.FormatFloat is 'G' and bitSize is 32.
func JoinFloat64WithFormatAndPrecision ¶
JoinFloat64WithFormatAndPrecision is the same as Join but joining float64 with a custom precision (bitSize) and format.
func JoinUint64 ¶
JoinUint64 is the same as Join but joining uint64.
func PrependIfMissing ¶
PrependIfMissing prepends the prefix to the start of the string if the string does not already start with any of the prefixes.
func PrependIfMissingIgnoreCase ¶
PrependIfMissing prepends the prefix to the start of the string if the string does not already start, case-insensitive, with any of the prefixes.
func RemoveEnd ¶
RemoveEnd removes a substring only if it is at the end of a source string, otherwise returns the source string.
func RemoveEndIgnoreCase ¶
RemoveEndIgnoreCase is the case insensitive removal of a substring if it is at the end of a source string, otherwise returns the source string.
func RemovePattern ¶
RemovePattern removes each substring of the source string that matches the given regular expression
func RemoveStart ¶
RemoveStart removes a substring only if it is at the beginning of a source string, otherwise returns the source string
func RemoveStartIgnoreCase ¶
RemoveStartIgnoreCase is the case insensitive removal of a substring if it is at the beginning of a source string, otherwise returns the source string.
func RepeatWithSeparator ¶
RepeatWithSeparator repeats a string `repeat` times to form a new String, with a string separator injected each time.
func ReverseDelimited ¶
ReverseDelimited reverses a string separated by a delimiter.
func StartsWith ¶
StartsWith check if a string starts with a specified prefix.
func StartsWithAny ¶
StartsWithAny check if a string starts with any of an array of specified strings.
func StartsWithAnyIgnoreCase ¶
StartsWithAnyIgnoreCase check if a string starts with any of an array of specified strings (ignoring case).
func StartsWithIgnoreCase ¶
StartsWithIgnoreCase case insensitive check if a string starts with a specified prefix.
func StripStart ¶
StripStart strips whitespace from the start of a String.
func SubstringAfter ¶
SubstringAfter gets the substring after the first occurrence of a separator.
func SubstringAfterLast ¶
SubstringAfterLast gets the substring after the last occurrence of a separator.
func SubstringBefore ¶
SubstringBefore gets the substring before the first occurrence of a separator.
func SubstringBeforeLast ¶
SubstringBeforeLast gets the substring before the last occurrence of a separator.
func SwapCase ¶
SwapCase swaps the case of a String changing upper and title case to lower case, and lower case to upper case.
func Uncapitalize ¶
Uncapitalize uncapitalizes a String, changing the first letter to lower case.
Types ¶
This section is empty.