Javascript String toFirstCase()

Description

Javascript String toFirstCase()


String.prototype.toFirstCase = function() {
 if (this.length >= 1) {
  return this.substr(0, 1).toUpperCase()
       + this.substr(1).toLowerCase()/* ww  w  .  j a v a2s . com*/
 }
 
 return this;
};



PreviousNext

Related