I am trying to split up a string by caps using Javascript,
Examples of what Im trying to do:
\"HiMyNameIsBob\" -> \"Hi My Name Is Bob\"
\"Greet
The solution for a text which starts from the small letter -
let value = "getMeSomeText";
let newStr = '';
for (var i = 0; i < value.length; i++) {
if (value.charAt(i) === value.charAt(i).toUpperCase()) {
newStr = newStr + ' ' + value.charAt(i)
} else {
(i == 0) ? (newStr += value.charAt(i).toUpperCase()) : (newStr += value.charAt(i));
}
}
return newStr;