Javascript: Convert proper name to Capital/Title Case

String.prototype.toTitleCase = function () { return this.toLowerCase().replace(/[^\s|\'\-]+/g, function(word) { return word.replace(/^./, function(first) { return first.toUpperCase(); }); }); }
Get proper names in Capital Case format:

example:

ÓLIVER DE LAS CASAS PIÑERO => Óliver De Las Casas Piñero

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.