Documentation
¶
Overview ¶
Package name implements naming conventions. The functions offer flexible parsing and strict formatting for label techniques such as snake_case, Lisp-case, CamelCase and (Java) property keys.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CamelCase ¶
CamelCase returns the medial capitals form of word sequence s. The input can be any case or even just a bunch of words. Upper case sequences (abbreviations) are preserved. Argument upper forces the letter case for the first rune. Use true for UpperCamelCase and false for lowerCamelCase.
Example ¶
package main
import (
"fmt"
"github.com/pascaldekloe/name"
)
func main() {
fmt.Println(name.CamelCase("pascal case", true))
fmt.Println(name.CamelCase("snake_to_camel AND CamelToCamel?", false))
}
Output: PascalCase snakeToCamelANDCamelToCamel
func Delimit ¶
Delimit returns word sequence s delimited with separator sep. The input can be any case or even just a bunch of words. Upper case sequences (abbreviations) are preserved. Use strings.ToLower and strings.ToUpper to enforce a letter case.
Example ¶
package main
import (
"fmt"
"github.com/pascaldekloe/name"
)
func main() {
// Garbage to Lisp-case:
fmt.Println(name.Delimit("* All Hype is aGoodThing (TM)", '-'))
// Builds a Java property key:
fmt.Println(name.DotSeparated("WebCrawler#socketTimeout"))
}
Output: all-hype-is-a-good-thing-TM web.crawler.socket.timeout
func DotSeparated ¶
DotSeparated is an alias for Delimit(s, '.').
Types ¶
This section is empty.