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 :: regular expression for password 
Javascript :: angular 10 get unique values from array of objects 
Javascript :: angular An accessor cannot be declared in an ambient context. 
Javascript :: cube camera three js 
Javascript :: discord login js 
Javascript :: javascript get name of element 
Javascript :: define keyframes with javascript 
Javascript :: unexpected token. did you mean `{'}` or `>`? react 
Javascript :: node.js read json file 
Javascript :: phone number validation regex 
Javascript :: Uncaught ReferenceError: axios is not defined 
Javascript :: javascript word start with 
Javascript :: npm fake server 
Javascript :: how to get data from ipfs 
Javascript :: pluck javascript 
Javascript :: get part of string javascript 
Javascript :: javascript json string 
Javascript :: es6 compare two arrays 
Javascript :: get day name from date javascript 
Javascript :: backbone events 
Javascript :: rendering htmnl element to DOM 
Javascript :: react native flatlist from bottom to top 
Javascript :: How can I refresh a page with jQuery 
Javascript :: react confirm alert 
Javascript :: redirect to page in javascript 
Javascript :: math format comma separated in javascript 
Javascript :: js conditional array element 
Javascript :: li key attribute 
Javascript :: xml to json api in asp.net 
Javascript :: match any character across multiple line regex 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =