In Javascript, I need a function to split a string based on if it's a capital letter.
Example:
string = "KitKat" should return "Kit Kat".
This is simple to do but, Where I am confused with is when there is a string like "IOTOttawa" I want it to return "IOT Ottawa".
If it has subsequent capitals then keep them together except for the last capital.
Something like that, this is what I have:
s = s.replace(/([a-z])([A-Z])/g, '$1 $2');
I tried using regex but maybe there is another way?