Documentation ¶
Index ¶
Constants ¶
View Source
const ( RuneOther = iota RuneLower RuneUpper RuneDigit )
Variables ¶
View Source
var ( LowerSnakeCase = makeCase("_", wrap(strings.ToLower)) UpperSnakeCase = makeCase("_", wrap(strings.ToUpper)) LowerKebabCase = makeCase("-", wrap(strings.ToLower)) UpperKebabCase = makeCase("-", wrap(strings.ToUpper)) LowerCamelCase = makeCase("", func(w string, i int) string { if i == 0 { return strings.ToLower(w) } return cases.Title(language.Und).String(w) }) UpperCamelCase = makeCase("", func(w string, i int) string { return cases.Title(language.Und).String(w) }) )
Functions ¶
func Split ¶
Split splits the camelcase word and returns a list of words. It also supports digits. Both lower camel case and upper camel case are supported. For more info please check: http://en.wikipedia.org/wiki/CamelCase Splitting rules
- If string is not valid UTF-8, return it without splitting as single item array.
- Assign all unicode characters into one of 4 sets: lower case letters, upper case letters, numbers, and all other characters.
- Iterate through characters of string, introducing splits between adjacent characters that belong to different sets.
- Iterate through array of split strings, and if a given string is upper case: if subsequent string is lower case: move last character of upper case string to beginning of lower case string
Types ¶
Click to show internal directories.
Click to hide internal directories.