I am new in Javascript. I have a little problem:
I have a string like this "thisIsATestString".
So how can I make this string to "This Is A Test String"?
I am new in Javascript. I have a little problem:
I have a string like this "thisIsATestString".
So how can I make this string to "This Is A Test String"?
Already answered: Convert camelCaseText to Sentence Case Text
You should have searched for "camel case to sentence."
This should help to resolve it.
const sentence = 'thisIsATestString';
const updatedSentenec = (sentence[0].toUpperCase() + sentence.slice(1)).split(/(?=[A-Z])/).join(' ')
Try this:
"thisIsATestString".replace(/(^\w|[A-Z])/g, function (match) {
return ' ' + match.toUpperCase();
}).trim();