strcase

package
v0.0.0-...-ee39e43 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 6 Imported by: 3

Documentation

Index

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 the set of common initialisms that should remain fully uppercased in PascalCase output. Derived from Go's standard initialisms list.

Functions

func ToCamelCase

func ToCamelCase(input string) string

func ToKebabCase

func ToKebabCase(input string) string

func ToKebabCaseLower

func ToKebabCaseLower(input string) string

func ToLower

func ToLower(input string) string

func ToPascalCase

func ToPascalCase(input string, extraAbbreviations ...string) string

ToPascalCase converts any input format (snake_case, kebab-case, camelCase, PascalCase) to PascalCase while fully uppercasing word segments that match known common initialisms (ID, URL, API, etc.).

Uses whole-segment matching on underscore-delimited words, so abbreviations within longer words are never matched (e.g., "sidney" does not match "ID").

Extra abbreviations beyond CommonInitialisms can be passed via the variadic parameter.

func ToPascalCaseTitledAbbreviations

func ToPascalCaseTitledAbbreviations(input string) string

func ToSnakeCase

func ToSnakeCase(input string) string

func ToSnakeCaseLower

func ToSnakeCaseLower(input string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL