Answers for "javascript lowercase string except first letter of every word if there are ''"

0

javascript lowercase string except first letter of every word

var text = "foo bar loo zoo moo";
text = text.toLowerCase()
    .split(' ')
    .map((s) => s.charAt(0).toUpperCase() + s.substring(1))
    .join(' ');
Posted by: Guest on September-10-2021
0

javascript lowercase string except first letter of every word if there are ''

var text = "foo bar 'loo' zoo moo";
text = text.toLowerCase().split(' ').map((s) => { if(s.charAt(0)!=="'") return s.charAt(0).toUpperCase() + s.substring(1)
      else return s.charAt(0)+s.charAt(1).toUpperCase() + s.substring(2)}).join(' ');
//text = "Foo Bar 'Loo' Zoo Moo"
Posted by: Guest on September-10-2021

Code answers related to "javascript lowercase string except first letter of every word if there are ''"

Code answers related to "Javascript"

Browse Popular Code Answers by Language