I've found a nice RegExp to transform "lower case name" to "Title Case Name" but I've noticed that it doesn't works correctly with French names like "Jean-Marie" that should stay and not transformed into "Jean-marie" and so on.
So, here it is the whole function with the RegExp:
function titleCase(source) {
return source.replace(/\w\S*/g, function(txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
});
}
So, the question: How can I modify the RegExp to take care also of the French names?
Thanks a lot for the answers!