Documentation
¶
Overview ¶
Package casing provides string case conversion utilities for transforming between camelCase, snake_case, kebab-case, and other naming conventions.
Index ¶
- func Camel(value string, transform ...TransformFunc) string
- func Identity(part string) string
- func Initialism(part string) string
- func Join(parts []string, sep string, transform ...TransformFunc) string
- func Kebab(value string, transform ...TransformFunc) string
- func LowerCamel(value string, transform ...TransformFunc) string
- func MergeNumbers(parts []string, suffixes ...string) []string
- func Snake(value string, transform ...TransformFunc) string
- func Split(value string) []string
- type TransformFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Camel ¶
func Camel(value string, transform ...TransformFunc) string
Camel converts a string to UpperCamelCase (PascalCase), applying optional transform functions to each word part before title-casing.
func Initialism ¶
Initialism is a TransformFunc that uppercases known initialisms such as "HTTP", "ID", and "URL", leaving other words unchanged.
func Join ¶
func Join(parts []string, sep string, transform ...TransformFunc) string
Join concatenates word parts with the given separator, applying each transform function in order to every part.
func Kebab ¶
func Kebab(value string, transform ...TransformFunc) string
Kebab converts a string to kebab-case, applying optional transform functions to each word part.
func LowerCamel ¶
func LowerCamel(value string, transform ...TransformFunc) string
LowerCamel converts a string to lowerCamelCase, applying optional transform functions to each word part.
func MergeNumbers ¶
MergeNumbers merges numeric parts with adjacent word parts, handling common suffixes like "GB", "K", and "P" (e.g., "4" + "K" becomes "4K").
func Snake ¶
func Snake(value string, transform ...TransformFunc) string
Snake converts a string to snake_case, applying optional transform functions to each word part.
Types ¶
type TransformFunc ¶
TransformFunc is a function that transforms a single word part during case conversion.