Created
September 18, 2013 01:42
-
-
Save monyskynet/6603366 to your computer and use it in GitHub Desktop.
To Title case from text From http://stackoverflow.com/questions/196972/convert-string-to-title-case-with-javascript/196991#196991
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toTitleCase(str) | |
{ | |
return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment