programming-examples/js/String/Uncapitalize the first letter of each word of a string.js

9 lines
294 B
JavaScript
Raw Normal View History

2019-11-15 12:59:38 +01:00
function unCapitalize_Words(str)
{
return str.replace(/\w\S*/g,
function(txt)
{
return txt.charAt(0).toLowerCase() + txt.substr(1).toLowerCase();});
}
console.log(unCapitalize_Words('Js String Exercises'));