changeStringCase
Function that given a string, a case type, and an optional delimiter, returns the string in the specified case or empty string.
Types
ChangeStringCaseProps
Parameters accepted by changeStringCase.
| Property | Type | Required | Description |
|---|---|---|---|
string | string | The input string to transform. When undefined or an empty string, the function returns an empty string. | |
caseType | "pascalCase" \| "snakeCase" \| "kebabCase" \| "camelCase" | ✓ | The target casing style to convert the input string to: - "camelCase" — e.g. "myVariableName" - "pascalCase" — e.g. "MyVariableName" - "snakeCase" — e.g. "my_variable_name" - "kebabCase" — e.g. "my-variable-name" |
delimiter | "upperCase" \| "lowerCase" \| string | An optional delimiter hint used when tokenising the input string. Accepts: - "upperCase" — Splits on uppercase letters (for camelCase / PascalCase input). - "lowerCase" — Splits on lowercase letters. - any other string — Used as a literal separator character (e.g. "-", "_", " "). When omitted, the function infers word boundaries automatically. |
