Created
January 19, 2018 13:59
-
-
Save TiagoGouvea/f166eb1439fb506a3cb1d63ead8190c9 to your computer and use it in GitHub Desktop.
ucWords to JavaScript
This file contains 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
fucntion ucWords (str) { | |
str = str.trim(); | |
str = str.toLowerCase().replace(/^[\u00C0-\u1FFF\u2C00-\uD7FF\w]|\s[\u00C0-\u1FFF\u2C00-\uD7FF\w]/g, function (letter) { | |
return letter.toUpperCase(); | |
}); | |
return str; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment