Documentation
¶
Overview ¶
Package strings provides functions for manipulating strings.
Index ¶
- func Base58ToHex(input string) (output string, err error)
- func Capitalize(input string) string
- func EnsureAlphanumeric(input string) string
- func ExtractLinks(haystack string) ([]string, error)
- func ExtractLinksWithValidator(haystack string, isLink func(input string) (bool, string)) ([]string, error)
- func FoldWhitespace(input string) (string, error)
- func FormatString(input string, replacements []string) string
- func HexToBase58(input string) (output string, err error)
- func IsAlphanumeric(input string) bool
- func IsWhitespace(r rune) bool
- func NormalizeCharSet(charSet string) string
- func NormalizePhone(input string) (string, error)
- func Permutations(input []string) [][]string
- func RemoveAny(haystack string, needles string) (string, error)
- func RemoveUnreadableCharacters(input string) (string, error)
- func RemoveWhitespace(input string) (string, error)
- func ReturnAllBetween(haystack string, startNeedle string, endNeedle string) []string
- func ReturnAllBetweenArray(haystack string, startNeedles []string, endNeedles []string) []string
- func ReturnAllBetweenInsensitive(haystack string, startNeedle string, endNeedle string) []string
- func ReturnAndRemoveAllBetween(haystack string, startNeedle string, endNeedle string, removeNeedles bool) (string, []string)
- func ReturnBetween(haystack string, startNeedle string, endNeedle string) string
- func ReturnBetweenInsensitive(haystack string, startNeedle string, endNeedle string) string
- func SplitAny(haystack string, needles string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base58ToHex ¶
Base58ToHex converts a base58-encoded string to hex.
func Capitalize ¶
Capitalize capitalizes the first letter of a string.
func EnsureAlphanumeric ¶
EnsureAlphanumeric removes any non-alphanumeric characters from a string.
func ExtractLinks ¶
ExtractLinks returns links from a plain/text body.
func ExtractLinksWithValidator ¶
func ExtractLinksWithValidator(haystack string, isLink func(input string) (bool, string)) ([]string, error)
ExtractLinksWithValidator returns links from a plain/text body, using a custom function to validate links.
func FoldWhitespace ¶
FoldWhitespace normalizes whitespace.
func FormatString ¶
FormatString formats a string, replacing % numeric expressions with their corresponding array values.
func HexToBase58 ¶
HexToBase58 converts a hex-encoded string to base58.
func IsAlphanumeric ¶
IsAlphanumeric returns true if the string consists of only letters and numbers.
func IsWhitespace ¶
IsWhitespace returns true if the rune is whitespace.
func NormalizeCharSet ¶
NormalizeCharSet replaces aliased character sets with their more common representation.
func NormalizePhone ¶
NormalizePhone formats phone numbers consistently.
func Permutations ¶
Permutations returns all permutations made through combinations of input nodes.
func RemoveUnreadableCharacters ¶
RemoveUnreadableCharacters removes non-human readable characters.
func RemoveWhitespace ¶
RemoveWhitespace removes whitespace.
func ReturnAllBetween ¶
ReturnAllBetween returns all substrings in haystack between startNeedle and endNeedle.
func ReturnAllBetweenArray ¶
ReturnAllBetweenArray returns all substrings in haystack between entries of startNeedles and entries of endNeedles.
func ReturnAllBetweenInsensitive ¶
ReturnAllBetweenInsensitive returns all substrings in haystack between startNeedle and endNeedle, case insensitive.
func ReturnAndRemoveAllBetween ¶
func ReturnAndRemoveAllBetween(haystack string, startNeedle string, endNeedle string, removeNeedles bool) (string, []string)
ReturnAndRemoveAllBetween returns all substrings in haystack between startNeedle and endNeedle, and removes them.
func ReturnBetween ¶
ReturnBetween returns the substring in haystack between startNeedle and endNeedle.
func ReturnBetweenInsensitive ¶
ReturnBetweenInsensitive returns the substring in haystack between startNeedle and endNeedle, case insensitive.
Types ¶
This section is empty.