Nodejs String Capitalize ucFirst()

Here you can find the source of ucFirst()

Method Source Code

//Returns the first character of a string in upper case
String.prototype.ucFirst = function(){

  //Matches the first word that start a string and returns it in upper case
  return this.replace(/^\w/, function(x){
    return x.toUpperCase();
  })/*from   ww w. ja v  a2s .co  m*/
}

Related

  1. ucFirst()
    String.prototype.ucFirst = function() {
      return this.substr(0, 1).toUpper() + this.substr(1);
    };
    
  2. ucFirst()
    String.prototype.ucFirst = function () {
        return this.substr(0,1).toUpperCase()+this.substr(1);
    };
    
  3. ucFirst()
    String.prototype.ucFirst = function(){
      result = this.replace(/^\w/g, function(x){
        return x.toUpperCase();
      });
      return result;
    };
    
  4. ucFirst()
    String.prototype.ucFirst = function() {
      return [this.charAt(0).toUpper(), this.slice(1)].join('');
    };
    
  5. ucFirst()
    String.prototype.ucFirst = function() {
        return this.charAt(0).toUpperCase() + this.slice(1);
    
  6. uc_first()
    String.prototype.uc_first = function() {
        return this.charAt(0).toUpperCase() + this.slice(1);
    };
    
  7. ucfirst()
    String.prototype.ucfirst = function () {
        return this.charAt(0).toUpperCase() + this.slice(1);
    };
    
  8. ucfirst()
    String.prototype.ucfirst = function() {
      return this.charAt(0) + this.slice(1);
    
  9. ucfirst()
    String.prototype.ucfirst = function() {
        return this.charAt(0).toUpperCase() + this.slice(1);