Case converter
Case converter. Runs entirely on your device, nothing is uploaded.
Runs on your device. The file is never uploaded.
Case converter rewrites each line into camel, pascal, snake, kebab, constant, title, upper or lower, chosen with to, which defaults to camel. Boundaries come three ways: a lowercase letter or digit before a capital, a capital run before a capital and a lowercase letter, and whitespace, underscores or hyphens. Punctuation is no boundary.
Questions
Which cases can it convert to?
Eight, through the to option, which defaults to camel: camel, pascal, snake, kebab, constant, title, upper and lower. camel gives firstWordThenCapitals, pascal capitalises the first word too, snake joins with underscores, kebab with hyphens, constant is upper-case with underscores, title capitalises each word with spaces, upper is all capitals with spaces, and lower is all lower case with spaces.
How does it decide where one word ends and the next begins?
By three rules, applied per line. A lower-case letter or digit followed by a capital is a boundary, so parseHTML splits before the H. A run of capitals followed by a capital and a lower-case letter is a boundary, so HTMLParser splits into HTML and Parser. And runs of whitespace, underscores and hyphens split as well. The pieces are then lower-cased and reassembled in the target style.
Why does my sentence come out looking mangled?
Because this is an identifier tool first. Punctuation is not a word boundary, so a full stop or a comma stays glued to the word next to it and gets carried into the joined output. On a list of variable names or file names the result is exactly right; on running prose with punctuation it will look odd. For prose, upper, lower and title are the three forms that survive it best.
Does it convert each line separately?
Yes. The file is split on line boundaries and each line is converted on its own, so a file with one identifier per line gives you one converted identifier per line. Lines that are empty or contain only whitespace are passed through untouched rather than collapsed, so the shape of the file is preserved.
Does title case follow a style guide?
No. title simply capitalises the first letter of every word and joins with single spaces. It does not lower-case short words like of, the and and the way a publisher's style guide would, and it does not know about proper nouns or acronyms. If you need editorial title case, treat the output as a starting point and fix it by hand.