Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript string proper case

function toTitleCase(str) {
  return str.replace(
    /wS*/g,
    function(txt) {
      return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
    }
  );
}
// example
toTitleCase("the pains and gains of self study");
// "The Pains And Gains Of Self Study"
Comment

PREVIOUS NEXT
Code Example
Javascript :: get json data into object 
Javascript :: jquery selector class child 
Javascript :: Disable/remove pagination from react material-table 
Javascript :: vuejs transform observer to object 
Javascript :: change cwd node 
Javascript :: Substring in Javascript using substring 
Javascript :: js add class to html 
Javascript :: d3 not reading json 
Javascript :: socketio connect websockets 
Javascript :: use inline and other styles react native 
Javascript :: react native shadow android 
Javascript :: nodejs create tree from directories 
Javascript :: ssr full form in nextjs 
Javascript :: get id value jquery 
Javascript :: javascript convert array to matrix 
Javascript :: Flatten a multidimension array 
Javascript :: javascript statement 
Javascript :: disabled text color tailwind 
Javascript :: javascript es6 find 
Javascript :: method chaining in javascript 
Javascript :: nestjs set swagger api keys 
Javascript :: angular build deploy url 
Javascript :: Encoding and Decoding Base64 Strings in Node.js 
Javascript :: getting te value of select multiple value 
Javascript :: filter react 
Javascript :: [W] undefined:undefined - Ruleset uses old version (version [1]). Please update to the latest version (version [2]). 
Javascript :: animate javascript 
Javascript :: vue js hooks 
Javascript :: get all object key names 
Javascript :: js setinterval vs settimeout 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =