How do I make the first letter of a string uppercase, but not change the case of any of the other letters?
For example:
\"this is a test\"
String.prototype.capitalize = function(){ return this.replace( /(^|\s)([a-z])/g , function(m,p1,p2){ return p1+p2.toUpperCase(); } ); };
Usage:
capitalizedString = someString.capitalize();
This is a text string => This Is A Text String