Just to get you started, using clipboard actions
Copy the string to a named clipboard
Filter Named clipboard action with whatever you want to do to Named Clipboard2
Paste from named clipboard2
You can see your named clipboards via KM Preferences
or you can just display them in your macro, display named clipboard action.
Also search this forum for clipboard and you will get many ideas.
I'm evaluating at the moment and was thinking of buying. This would be a killer feature for me well worth the ticket price, but the investment in learning how to DYI it is more than I can invest right now.
OK give a couple of test cases of the input and your required output, and by tomorrow someone on the forum will probably give you an answer.
Also please read the first few chapters of the pdf I have sent you as that will give you a framework to proceed further.
I'll make you the full macro shortly.
First, a non-forum message that you have to promise us... Never... Ever give up on Keyboard Maestro. Even if it couldn't do one feature, there are tons upon tons of other features that it solves. It's almost like turning down a $9,999 loan, from a bank, because you asked for $10,000. I'm messing around but I'm 99% not.
Anyway, @jonathonl gave you the true blueprint but I just made it visual for you.
Let me know if this build will work.
You highlight the text you want to convert.
You hit a hotkey of your choice - Say shift-command-k
You get a prompt to select which case
You select command-v to paste it in your area.
Will that work or is that about it?
Let me know so we can help. Once we get it there, I'll upload the macro. Deal?
I am blown away by the support here! OK, I'm buying KM. Yes that sounds great, or a separate shortcut for each case type. Ideally it would convert between all case types (Camel Case => Kebab Case => Spaced String, etc.)
Hopefully one day I will be able to help someone else as you both have helped me today.
Do you want it to automatically replace the selected case (as in you are in Pages or text edit)? Or is it you just want to be able to paste it anywhere?
This is actually a very easy use case for KM, IF you know a little about RegEx.
KM makes Regular Expressions very easy to use. The challenge, of course, is coming up with the RegEx. But if you can't figure it out, you can always google it. Your use case is very common, and very old. I'm sure many have already developed the RegEx for it.
But it looks like @kcwhat has got you on the right track.
I'd just make two comments:
I would NOT use KM Named Clipboards for this use case. The only time you really need a Named Clipboard is when you need to store rich text, images, or other objects. Named Clipboards are harder to use, and take up a lot more storage space on your Mac.
If you happen to find a JavaScript RegEx solution, it almost always easier to use the KM native RegEx tools