Documentation
¶
Overview ¶
Package str provides string utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CamelSplit ¶
CamelSplit splits a camelcase word and returns a list of words. It also supports digits. Both lower camel case and upper camel case are supported. As per Go naming conventions multiple Upper case letters together are considered an abbreviation and therefore a word.
Examples:
"" → [] "lowercase" → ["lowercase"] "Class" → ["Class"] "MyClass" → ["My", "Class"] "MyC" → ["My", "C"] "HTML" → ["HTML"] "PDFLoader" → ["PDF", "Loader"] "AString" → ["A", "String"] "SimpleXMLParser" → ["Simple", "XML", "Parser"] "vimRPCPlugin" → ["vim", "RPC", "Plugin"] "GL11Version" → ["GL", "11", "Version"] "99Bottles" → ["99", "Bottles"] "May5" → ["May", "5"] "BFG9000" → ["BFG", "9000"] "BöseÜberraschung" → ["Böse", "Überraschung"] "Two spaces" → ["Two", " ", "spaces"] "BadUTF8\xe2\xe2\xa1" → ["BadUTF8\xe2\xe2\xa1"]
This code is inspired by https://github.com/fatih/camelcase (MIT licensed).
func ToCamelCase ¶ added in v0.0.12
ToCamelCase converts a string to lower camel case (as used for unexported Go indentifiers), converting the entire first word to lowercase. The word boundaries are located as per CamelSplit. For example, "HelloWorld" becomes "helloWorld", "HTTPDir" becomes "httpDir". If the string contains invalid utf-8, the result is undefined.
Types ¶
This section is empty.