Documentation ¶
Overview ¶
Package cases contains functions for Maping strings between various cases (snake, pascal, etc).
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Words ¶
type Words []string
Words are a list of strings.
func Camel ¶
Camel separates and returns the words in s, where each new word begins with an uppercase letter. Camel parses identically to Pascal(), but is declared for symmetry with Words.ToCamel().
Example ¶
fmt.Println(Camel("catSaysMeow"), Words{"cat", "says", "meow"}.ToCamel())
Output: [cat Says Meow] catSaysMeow
func Pascal ¶
Pascal separates and returns the words in s, where each word begins with a uppercase letter.
Example ¶
fmt.Println(Pascal("CatSaysMeow"), Words{"cat", "says", "meow"}.ToPascal())
Output: [Cat Says Meow] CatSaysMeow
func Snake ¶
Snake separates and returns the words in s by underscore.
Example ¶
fmt.Println(Snake("cat_says_meow"), Words{"cat", "says", "meow"}.ToSnake())
Output: [cat says meow] cat_says_meow
func (Words) ToCamel ¶
ToCamel returns all the words concatenated with each word beginning with an uppercase letter, except for the first.
func (Words) ToPascal ¶
ToPascal returns all the words concatenated with each word beginning with an uppercase letter.