Created
February 9, 2018 01:11
-
-
Save eolant/9d24929f9ddae295a1008a9fbc59e508 to your computer and use it in GitHub Desktop.
Title case utf8 string javascript function
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
function toTitleCase(str) { | |
return str.replace(/[\u00C0-\u1FFF\u2C00-\uD7FF\w]+\s*/g, function (txt) { | |
return txt.charAt(0).toUpperCase() + txt.substr(1); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment