Documentation ¶
Index ¶
- func CamelCase(s string, seps ...string) string
- func Capitalize(s string) string
- func CapitalizeAll(s string) string
- func DefaultMaskToken(s string) string
- func EncodeUrlValues(values map[string][]string, escapeFunc func(string) string) string
- func FastBtos(bs []byte) string
- func FastStob(s string) []byte
- func GetLeft(s string, length int) string
- func GetRight(s string, length int) string
- func KebabCase(s string, seps ...string) string
- func MaskToken(s string, mask rune, indices ...int) string
- func PadLeft(s string, char rune, totalLength int) string
- func PadRight(s string, char rune, totalLength int) string
- func PascalCase(s string, seps ...string) string
- func RandCapitalLetterNumberString(count int) string
- func RandCapitalLetterString(count int) string
- func RandLetterString(count int) string
- func RandLowercaseLetterNumberString(count int) string
- func RandLowercaseLetterString(count int) string
- func RandNumberString(count int) string
- func RandString(count int, runes []rune) string
- func RemoveBlanks(s string) string
- func SnakeCase(s string, seps ...string) string
- func SplitAndGet(s string, sep string, index int) string
- func TimeUUID(t time.Time, count int) string
- func Uncapitalize(s string) string
- func UncapitalizeAll(s string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CamelCase ¶ added in v1.5.0
CamelCase rewrites string in camel case using word separator. By default "_", "-". ".", " ", " " are treated as word separator.
func Capitalize ¶
Capitalize capitalizes the first letter of the whole string, this will ignore all trailing spaces.
func CapitalizeAll ¶ added in v1.5.0
CapitalizeAll capitalizes all the first letter in words of the whole string, this will trim the trailing space.
func DefaultMaskToken ¶ added in v1.5.0
DefaultMaskToken masks and returns a token string. Here the masked result only shows the first and last two characters at most, and the length of characters shown is restrict less than masked.
func EncodeUrlValues ¶ added in v1.5.0
EncodeUrlValues encodes the values (see url.Values) into url encoded form ("bar=baz&foo=quux") sorted by key with escape. The escapeFunc can be url.QueryEscape, url.PathEscape or the functions you defined, use nil for no escape.
func KebabCase ¶ added in v1.5.0
KebabCase rewrites string in kebab case using word separator. By default "_", "-". ".", " ", " " are treated as word separator.
func MaskToken ¶
MaskToken masks and returns a token string with given mask run and indices array, which support minus index.
func PadLeft ¶ added in v1.4.4
PadLeft returns the string with length of totalLength, which is padded by char in left.
func PadRight ¶ added in v1.4.4
PadRight returns the string with length of totalLength, which is padded by char in right.
func PascalCase ¶ added in v1.5.0
PascalCase rewrites string in pascal case using word separator. By default "_", "-". ".", " ", " " are treated as word separator.
func RandCapitalLetterNumberString ¶ added in v1.5.0
RandCapitalLetterNumberString generates a random string combined by capital letters and numbers, that is ABCDEFGHIJKLMNOPQRSTUVWXYZ + 0123456789.
func RandCapitalLetterString ¶ added in v1.5.0
RandCapitalLetterString generates a random string combined by capital letters, that is ABCDEFGHIJKLMNOPQRSTUVWXYZ.
func RandLetterString ¶
RandLetterString generates a random string combined by allcase letters, that is ABCDEFGHIJKLMNOPQRSTUVWXYZ + abcdefghijklmnopqrstuvwxyz.
func RandLowercaseLetterNumberString ¶ added in v1.5.0
RandLowercaseLetterNumberString generates a random string combined by lowercase letters and numbers, that is abcdefghijklmnopqrstuvwxyz + 0123456789.
func RandLowercaseLetterString ¶ added in v1.5.0
RandLowercaseLetterString generates a random string combined by lowercase letters, that is abcdefghijklmnopqrstuvwxyz.
func RandNumberString ¶
RandNumberString generates a random string combined by numbers, that is 0123456789.
func RandString ¶
RandString generates a string by given rune slice in random order.
func RemoveBlanks ¶ added in v1.5.0
RemoveBlanks replaces all blanks (\s and a wide space) to a single space. About blank, see unicode.IsSpace.
func SnakeCase ¶ added in v1.5.0
SnakeCase rewrites string in snake case using word separator. By default "_", "-". ".", " ", " " are treated as word separator.
func SplitAndGet ¶ added in v1.5.0
SplitAndGet returns the string item from the split result slices, this also supports minus index.
func TimeUUID ¶ added in v1.5.0
TimeUUID creates a uuid from given time. If the count is larger than 23, the remaining bits will be filled by rand numbers.
func Uncapitalize ¶
Uncapitalize uncapitalizes the first letter of the whole string, this will ignore all trailing spaces.
func UncapitalizeAll ¶ added in v1.5.0
UncapitalizeAll uncapitalizes all the first letter in words of the whole string, this will trim the trailing space.
Types ¶
This section is empty.