Javascript: Convert proper name to Capital/Title Case

1
2
function toCapitalCase(str) {
- return str.replace(/.\S*/g, function(txt){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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.