Skip to content

Instantly share code, notes, and snippets.

@eolant
Created February 9, 2018 01:11
Show Gist options
  • Save eolant/9d24929f9ddae295a1008a9fbc59e508 to your computer and use it in GitHub Desktop.
Save eolant/9d24929f9ddae295a1008a9fbc59e508 to your computer and use it in GitHub Desktop.
Title case utf8 string javascript function
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