Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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(' ');
Comment

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"
Comment

PREVIOUS NEXT
Code Example
Javascript :: How to swap two array elements in JavaScript 
Javascript :: javascript detect if element is scrolled 
Javascript :: select all checkbox jquery 
Javascript :: jquery select a dynamic element 
Javascript :: delete from array based on value javascript 
Javascript :: es6 map usin index 
Javascript :: fs , valid path check 
Javascript :: javascript date method 
Javascript :: Axios FormData / not JSON 
Javascript :: mongoose delete property 
Javascript :: loop in react depending on number 
Javascript :: javascript check if array has duplicate values 
Javascript :: how to get element of an array in javascript 
Javascript :: rect p5js 
Javascript :: reverse 179 in javascript 
Javascript :: convert data into json format in javascript 
Javascript :: getx arguments 
Javascript :: document print from html javascript 
Javascript :: errors in Joi 
Javascript :: json with multiple objects 
Javascript :: slick slider multiple sliders on one page 
Javascript :: javascript get point of line intersection 
Javascript :: share link to whatsapp javascript 
Javascript :: set date to input date js 
Javascript :: javascript remove underscore and capitalize 
Javascript :: await useeffect react 
Javascript :: mongoose find by and delete 
Javascript :: .find() is not a function 
Javascript :: js trigger window resize 
Javascript :: iframe content in chrome console 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =