Node.js examples for String:Case
String to capitalize Words
String.prototype.capitalizeWords = function() { var words = this.split(/\s+/), wordCount = words.length,//from ww w.ja v a2 s. co m i, newWords = []; for (i = 0; i < wordCount; i++) { newWords.push(words[i].capitalize()); } return newWords.join(' '); };