Add/insert space before the Capital letters in a word/String in JavaScript:
var data = "RajendraPrasad";
data = data.replace(/([A-Z])/g, ' $1').trim();
console.log(data);
Output:
"Rajendra Prasad"
var data = "RajendraPrasad";
data = data.replace(/([A-Z])/g, ' $1').trim();
console.log(data);
Output:
"Rajendra Prasad"
Comments
Post a Comment