Nodejs String Capitalize ucfirst()

Here you can find the source of ucfirst()

Method Source Code

/**/*  w  w  w. j  ava2s  . c o  m*/
 * A collection of extension for the native JavaScript
 * extended using the prototype
 */

String.prototype.ucfirst = function () {
    return this.charAt(0).toUpperCase() + this.slice(1);
};

Related

  1. ucfirst()
    String.prototype.ucfirst = function() {
        return this.charAt(0).toUpperCase() + this.substr(1);
    };
    function isset(args) {
      return (typeof args !== 'undefined' && args !== null);
    
  2. ucfirst()
    String.prototype.ucfirst = function() {
        return this.charAt(0).toUpperCase() + this.slice(1);
    String.prototype.lcfirst = function() {
        return this.charAt(0).toLowerCase() + this.slice(1);
    
  3. ucfirst()
    String.prototype.ucfirst = function() {
      return this.substr(0, 1).toUpperCase() + this.substr(1, this.length);
    };
    
  4. ucfirst()
    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;
    
  5. ucfirst()
    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;
    };
    ...
    
  6. ucfirst()
    String.prototype.ucfirst = function() {
      var x = this.split(/\s+/g);
      for (var i = 0; i < x.length; i++) {
        var parts = x[i].match(/(\w)(\w*)/);
        x[i] = parts[1].toUpperCase() + parts[2].toLowerCase();
      return x.join(' ');
    };
    
  7. ucfirst()
    String.prototype.ucfirst = function(){
      return this.replace(/(^[a-z])/,function(v){return v.toUpperCase();});
    };
    
  8. ucfirst()
    String.prototype.ucfirst = function() {
        return this.substr(0, 1).toUpperCase() + this.substr(1);
    
  9. ucfirst()
    String.prototype.ucfirst = function(){
      var str = this + '';
        return str.charAt(0).toUpperCase() + str.substr(1);