Here you can find the source of ucfirst()
String.prototype.ucfirst = function() { // Split the string into words if string contains multiple words. var x = this.split(/\s+/g); for (var i = 0; i < x.length; i++) { // Splits the word into two parts. One part being the first letter, // second being the rest of the word. var parts = x[i].match(/(\w)(\w*)/); // Put it back together but uppercase the first letter and lowercase the // rest of the word. x[i] = parts[1].toUpperCase() + parts[2].toLowerCase(); }/* www. java 2 s. co m*/ // Rejoin the string and return. return x.join(' '); };
String.prototype.ucfirst = function() { return this.charAt(0).toUpperCase() + this.slice(1); String.prototype.lcfirst = function() { return this.charAt(0).toLowerCase() + this.slice(1);
String.prototype.ucfirst = function() { return this.substr(0, 1).toUpperCase() + this.substr(1, this.length); };
String.prototype.ucfirst = function() var aString = this; var aResult = aString.charAt(0).toUpperCase(); for (var i=1;i<aString.length;i++) { aResult += aString.charAt(i); return aResult;
String.prototype.ucfirst = function() { return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); }; function roundNumber(num, dec) { var result = String(Math.round(num*Math.pow(10,dec))/Math.pow(10,dec)); if(result.indexOf('.')<0) {result+= '.';} while(result.length- result.indexOf('.')<=dec) {result+= '0';} return result; }; ...
String.prototype.ucfirst = function () { return this.charAt(0).toUpperCase() + this.slice(1); };
String.prototype.ucfirst = function(){ return this.replace(/(^[a-z])/,function(v){return v.toUpperCase();}); };
String.prototype.ucfirst = function() { return this.substr(0, 1).toUpperCase() + this.substr(1);
String.prototype.ucfirst = function(){ var str = this + ''; return str.charAt(0).toUpperCase() + str.substr(1);
String.prototype.ucfirst = function(str) { str += ''; var f = str.charAt(0).toUpperCase(); return f + str.substr(1); };