Here you can find the source of firstToUpper()
// ---------------------------------------------------------------------------- // USEFUL STUFF//from w ww. j a v a 2 s. c o m // ---------------------------------------------------------------------------- var useful = {} String.prototype.firstToUpper = function() { return this.charAt(0).toUpperCase() + this.slice(1); } Array.prototype.shuffle = function() { var currentIndex = this.length, temporaryValue, randomIndex ; // While there remain elements to shuffle... while (0 !== currentIndex) { // Pick a remaining element... randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; // And swap it with the current element. temporaryValue = this[currentIndex]; this[currentIndex] = this[randomIndex]; this[randomIndex] = temporaryValue; } return this; } useful.clamp = function(value, min, max) { return Math.max(min, Math.min(value, max)); } useful.lerp = function(a, b, amount) { useful.clamp(amount, 0, 1) return ((1-amount)*a + amount*b); }
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); };
String.prototype.firstToUpper = function() { return this.charAt(0).toUpperCase() + this.slice(1);
String.prototype.firstUpper = function() { return this.charAt(0).toUpperCase() + this.slice(1); };