Nodejs String Capitalize ucFirst()

Here you can find the source of ucFirst()

Method Source Code

String.prototype.ucFirst = function() {
  /**//  w  w w. j  av a2s . c  o  m
   * Return this String with it's first letter in uppercase.
   */
  return [this.charAt(0).toUpper(), this.slice(1)].join('');
};

Related

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