Documentation ¶
Index ¶
- Variables
- func SplitIntoWords(s string) []string
- func SplitIntoWordsWithInitialisms(s string, initialisms map[string]bool) []string
- func ToLowerCamel(s string) string
- func ToLowerCamelWithInitialisms(s string, initialisms map[string]bool) string
- func ToLowerSnake(s string) string
- func ToUpperCamel(s string) string
- func ToUpperCamelWithInitialisms(s string, initialisms map[string]bool) string
- func ToUpperSnake(s string) string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CommonInitialisms = map[string]bool{ "acl": true, "api": true, "ascii": true, "cpu": true, "css": true, "dns": true, "eof": true, "guid": true, "html": true, "http": true, "https": true, "id": true, "ip": true, "json": true, "lhs": true, "qps": true, "ram": true, "rhs": true, "rpc": true, "sla": true, "smtp": true, "sql": true, "ssh": true, "tcp": true, "tls": true, "ttl": true, "udp": true, "ui": true, "uid": true, "uuid": true, "uri": true, "url": true, "utf8": true, "vm": true, "xml": true, "xmpp": true, "xsrf": true, "xss": true, }
CommonInitialisms is a set of common initialisms. Copy from https://github.com/golang/lint `commonInitialisms`.
Functions ¶
func SplitIntoWordsWithInitialisms ¶ added in v1.0.1
SplitIntoWordsWithInitialisms splits string to words with initialisms.
func ToLowerCamel ¶
ToLowerCamel convert string to lowerCamel.
Example ¶
fmt.Println(strcase.ToLowerCamel("lowerCamel")) fmt.Println(strcase.ToLowerCamel("UpperCamel")) fmt.Println(strcase.ToLowerCamel("lower_snake")) fmt.Println(strcase.ToLowerCamel("UPPER_SNAKE"))
Output: lowerCamel upperCamel lowerSnake upperSnake
func ToLowerCamelWithInitialisms ¶ added in v1.0.1
ToLowerCamelWithInitialisms convert string to lowerCamel with initialisms.
func ToLowerSnake ¶
ToLowerSnake convert string to lower_snake.
Example ¶
fmt.Println(strcase.ToLowerSnake("lowerCamel")) fmt.Println(strcase.ToLowerSnake("UpperCamel")) fmt.Println(strcase.ToLowerSnake("lower_snake")) fmt.Println(strcase.ToLowerSnake("UPPER_SNAKE"))
Output: lower_camel upper_camel lower_snake upper_snake
func ToUpperCamel ¶
ToUpperCamel convert string to UpperCamel.
Example ¶
fmt.Println(strcase.ToUpperCamel("lowerCamel")) fmt.Println(strcase.ToUpperCamel("UpperCamel")) fmt.Println(strcase.ToUpperCamel("lower_snake")) fmt.Println(strcase.ToUpperCamel("UPPER_SNAKE"))
Output: LowerCamel UpperCamel LowerSnake UpperSnake
func ToUpperCamelWithInitialisms ¶ added in v1.0.1
ToUpperCamelWithInitialisms convert string to UpperCamel with initialisms.
func ToUpperSnake ¶
ToUpperSnake convert string to UPPER_SNAKE.
Example ¶
fmt.Println(strcase.ToUpperSnake("lowerCamel")) fmt.Println(strcase.ToUpperSnake("UpperCamel")) fmt.Println(strcase.ToUpperSnake("lower_snake")) fmt.Println(strcase.ToUpperSnake("UPPER_SNAKE"))
Output: LOWER_CAMEL UPPER_CAMEL LOWER_SNAKE UPPER_SNAKE
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.