Documentation ¶
Overview ¶
Package casbab is a Go library for converting representation style of compound words or phrases. Different writing styles of compound words are used for different purposes in computer code and variables to easily distinguish type, properties or meaning.
Functions in this package are separating words from input string and constructing an appropriate phrase representation.
Examples:
Kebab("camel_snake_kebab") == "camel-snake-kebab" ScreamingSnake("camel_snake_kebab") == "CAMEL_SNAKE_KEBAB" Camel("camel_snake_kebab") == "camelSnakeKebab" Pascal("camel_snake_kebab") == "CamelSnakeKebab" Snake("camelSNAKEKebab") == "camel_snake_kebab"
Word separation works by detecting delimiters hyphen (-), underscore (_), space ( ) and letter case change.
Note: Leading and trailing separators will be preserved only within the Snake family or within the Kebab family and not across them. This restriction is based on different semantics between different writings.
Examples:
CamelSnake("__camel_snake_kebab__") == "__Camel_Snake_Kebab__" Kebab("__camel_snake_kebab") == "camel-snake-kebab" Screaming("__camel_snake_kebab") == "CAMEL SNAKE KEBAB" CamelKebab("--camel-snake-kebab") == "--Camel-Snake-Kebab" Snake("--camel-snake-kebab") == "camel_snake_kebab" Screaming("--camel-snake-kebab") == "CAMEL SNAKE KEBAB"
Index ¶
- func Camel(s string) string
- func CamelKebab(s string) string
- func CamelSnake(s string) string
- func Kebab(s string) string
- func Lower(s string) string
- func Pascal(s string) string
- func Screaming(s string) string
- func ScreamingKebab(s string) string
- func ScreamingSnake(s string) string
- func Snake(s string) string
- func Title(s string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Camel ¶
Camel case is the practice of writing compound words or phrases such that each word or abbreviation in the middle of the phrase begins with a capital letter, with no spaces or hyphens.
Example: "camelSnakeKebab".
func CamelKebab ¶
CamelKebab case is a variant of Kebab case with each element's first letter uppercased.
Example: "Camel-Snake-Kebab".
func CamelSnake ¶
CamelSnake case is a variant of Camel case with each element's first letter uppercased.
Example: "Camel_Snake_Kebab".
func Kebab ¶
Kebab case is the practice of writing compound words or phrases in which the elements are separated with one hyphen character (-) and no spaces, with all element letters lowercased within the compound.
Example: "camel-snake-kebab".
func Lower ¶
Lower is returning detected words, not in a compound form, but separated by one space character with all letters in lower case.
Example: "camel snake kebab".
func Pascal ¶
Pascal case is a variant of Camel case writing where the first letter of the first word is always capitalized.
Example: "CamelSnakeKebab".
func Screaming ¶
Screaming is returning detected words, not in a compound form, but separated by one space character with all letters in upper case.
Example: "CAMEL SNAKE KEBAB".
func ScreamingKebab ¶
ScreamingKebab case is a variant of Kebab case with all letters uppercased.
Example: "CAMEL-SNAKE-KEBAB".
func ScreamingSnake ¶
ScreamingSnake case is a variant of Camel case with all letters uppercased.
Example: "CAMEL_SNAKE_KEBAB".
Types ¶
This section is empty.