I'm trying to obtain a camel case string (but with the first letter capitalized).
I'm using the following regular expression code in JavaScript:
String.prototype.toCamelCase = function() {
return this.replace(/^([A-Z])|\s(\w)/g, function(match, p1, p2, offset) {
if (p2) return p2.toUpperCase();
return p1.toLowerCase();
});
but the first letter is converted to a lower case.