DevToys
DevToys copied to clipboard
Text Case Convert does not work
Description
The Converters do not work as expected.
Steps To Reproduce
- Navigate to Text Case Converter and Inspector
- Type FooBar into the textfield
- Click the kebab-case button
- The result is foobar instead of foo-bar
Expected behavior
foo-bar
DevToys Version
1.0.3.0
Relevant Assets/Logs
Is this really a bug, or just not working the way you assumed...? I don't think the tool should treat all mid-word caps to be in PascalCase. How, for example, should the converter handle these?
-
FOOBAR
-
FooBAR
-
FOOBar
-
FOObar
-
fooBAR
Perhaps there needs to be some selector for the input case where there's ambiguity, but if the tool always treats [\s\-_]
as the word separators it is, at least, unambiguous.
It would be nice if it would work like here: https://textedit.tools/kebabcase
- FOOBAR => foobar
- FooBAR => foo-bar
- FOOBar => foo-bar
- FOObar => fo-obar
- fooBAR => foo-bar
Right, I see.
Perhaps a "Treat capitalization as word boundary" setting is needed that can be toggled on and off, which finds ([a-z\d])([A-Z])
and ([A-Z\d])([A-Z][a-z])
groups.
The only case I can think of where a capital letter in the middle of a word is not a word boundary is tHiS cAsE and I don't know what it's called but I don't feel that's something a case converter for devs needs to support. So IMO for all intents and purposes a capital in the middle of the word is always a word boundary.
Edit: The first one only of course, as we can't really say for sure if fooBAR is two, three or four words. Personally I'd go with two words, but that is probably biased.