Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Capitalize first letter of each word

const toTitleCase = str => str.replace(/(^w|sw)(S*)/g, (_,m1,m2) => m1.toUpperCase()+m2.toLowerCase())

console.log(toTitleCase("heLLo worLd"));
// Hello World
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Capitalize #letter #word
ADD COMMENT
Topic
Name
6+8 =