Documentation ¶
Overview ¶
package strcase is a go package for converting string case to various cases (e.g. snake case or camel case).
Example ¶
package main import ( "fmt" "github.com/sraphs/go/x/strcase" ) func main() { fmt.Println(strcase.ToCamel("AnyKind.of_string")) fmt.Println(strcase.ToPascal("AnyKind.of_string")) fmt.Println(strcase.ToSnake("AnyKind.of_string")) fmt.Println(strcase.ToSnakeWithIgnore("AnyKind.of_string", ".")) fmt.Println(strcase.ToDot("AnyKind.of_string")) fmt.Println(strcase.ToDotWithIgnore("AnyKind.of_string", "_")) fmt.Println(strcase.ToKebab("AnyKind.of_string")) fmt.Println(strcase.ToKebabWithIgnore("AnyKind.of_string", ".")) }
Output: anyKindOfString AnyKindOfString any_kind_of_string any_kind.of_string any.kind.of.string any.kind.of_string any-kind-of-string any-kind.of-string
Index ¶
- func ConfigureAcronym(key, val string)
- func ToCamel(s string) string
- func ToDelimited(s string, delimiter rune) string
- func ToDot(s string) string
- func ToDotWithIgnore(s string, ignore string) string
- func ToKebab(s string) string
- func ToKebabWithIgnore(s string, ignore string) string
- func ToPascal(s string) string
- func ToSnake(s string) string
- func ToSnakeWithIgnore(s string, ignore string) string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureAcronym ¶
func ConfigureAcronym(key, val string)
ConfigureAcronym allows you to add additional words which will be considered acronyms
func ToDelimited ¶
ToDelimited converts a string to delimited.snake.case (in this case `delimiter = '.'`)
func ToDotWithIgnore ¶
func ToKebabWithIgnore ¶
func ToSnakeWithIgnore ¶
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.