Micro-library that converts between different identifier casing styles. e.g., "camelCasedString" → "camel_cased_string".
Supported join styles:
- camelStyle (
- snake_style (
- kebab-style (
- space style (
Supported case styles:
- Preserve—don't modify case (
- CAPSSTYLE (
- UpperStyle (
- lowerUpperStyle (
- lowerstyle (
You can implement extra join styles by conforming to
WordJoinStyle: implement a split function and specify a join separator.
You can implement extra case styles using
WordCaseTransformers transform one word at a time given the current index.
WordCaseSimpleTransformer is an implementation of
WordCaseTransformer that applies another
WordCaseTransformer for the first word, and then yet another for all subsequent words.
WordCase implements the basic CAPS, Upper and lower transformations, or you can create your own.
See tests in
Tests/InAnyCaseTests/InAnyCaseTests.swift for usage examples.
Available under the MIT License. See
This library uses sharplet/Regex, which is also provided by its author under the MIT License.