Converting between naming conventions
Most case conversion is mechanical until you hit the edge cases, which is where tools usually go wrong. Apostrophes are the classic one: a rule based on word boundaries sees the apostrophe in don't as a break and produces Don'T. This converter uses a letter-boundary rule instead.
The programming cases — camel, Pascal, snake, kebab and constant — all work by splitting the input into words first. That split understands existing camelCase, so XMLHttpRequest becomes xml-http-request rather than one long token. Converting between conventions is therefore lossless in both directions for ordinary identifiers.
Where each convention is used
- camelCase — variables and functions in JavaScript, Java, Swift.
- PascalCase — classes, types and React components.
- snake_case — Python and Ruby identifiers, SQL column names.
- kebab-case — CSS classes, HTML attributes and URL slugs. For URLs specifically the slug generator also strips accents and punctuation.
- CONSTANT_CASE — environment variables and compile-time constants.