Convert String to Title Case - Node.js String

Node.js examples for String:Case

Description

Convert String to Title Case

Demo Code



toTitleCase: function (str) {
  return str.replace(/\w\S*/g, function (txt) {
    return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
  });//from   w ww . ja  v  a2  s.c  o m
},

Related Tutorials