Is there a way to take a text entry from a form and make sure/change the first letter of each word is capitalized and the rest are lowercase?
Is there a way to take a text entry from a form and make sure/change the first letter of each word is capitalized and the rest are lowercase?
Code:String.prototype.toTitleCase = function() { var words = this.toLowerCase().split(" "); for(var i=0;i<words.length;i++) words[i] = words[i].charAt(0).toUpperCase() + words[i].substring(1); return words.join(" "); } var sentence = "tHE QuiCk bRoWN Fox jUMpS oVEr THE LaZY dog"; window.alert(sentence.toTitleCase());
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Bookmarks