Javascript: Convert proper name to Capital/Title Case

function toCapitalCase(str) { return str.replace(/.\S*/g, function(txt){ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); }); ]
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.