casing

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package casing provides string case conversion utilities for transforming between camelCase, snake_case, kebab-case, and other naming conventions.

Index

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 Identity

func Identity(part string) string

Identity is a TransformFunc that returns the input string unchanged.

func Initialism

func Initialism(part string) string

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

func MergeNumbers(parts []string, suffixes ...string) []string

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.

func Split

func Split(value string) []string

Split breaks a string into word parts by detecting case transitions, separators (spaces, punctuation, underscores, hyphens), and symbol boundaries.

Types

type TransformFunc

type TransformFunc func(string) string

TransformFunc is a function that transforms a single word part during case conversion.

Jump to

Keyboard shortcuts

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