Skip to content

Instantly share code, notes, and snippets.

@TiagoGouvea
Created January 19, 2018 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TiagoGouvea/f166eb1439fb506a3cb1d63ead8190c9 to your computer and use it in GitHub Desktop.
Save TiagoGouvea/f166eb1439fb506a3cb1d63ead8190c9 to your computer and use it in GitHub Desktop.
ucWords to JavaScript
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