Nodejs String Trim Left trimLeft()

Here you can find the source of trimLeft()

Method Source Code

// This function removes all spaces at the beginning of a string
String.prototype.trimLeft = function() {
   return this.replace(/^\s+/, '');   
};

Related

  1. ltrim()
    String.prototype.ltrim = function()
      return this.replace( /^\s*/g, '' ) ;
    
  2. ltrim()
    String.prototype.ltrim = function(){
        var res = this;
        while (res.substring(0, 1) == " ") {
            res = res.substring(1, res.length);
        return res;
    
  3. ltrim()
    String.prototype.ltrim=function()
      {return this.replace(/^\s+/,'');}
    
  4. ltrim(ch)
    String.prototype.ltrim = function(ch) {
        var r = new RegExp("^{0}+".format(ch || "\\s"));
        return this.replace(r, "");
    };
    
  5. ltrim(charlist)
    String.prototype.ltrim = function (charlist) {
      charlist = !charlist ? ' \\s\u00A0' : (charlist + '').replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '$1');
      var re = new RegExp('[' + charlist + ']+$', 'g');
      return this.replace(re, '');
    };
    
  6. trimLeft()
    String.prototype.trimLeft = String.prototype.trimLeft || function() {
      return this.replace(/^\s+/,'');
    };
    
  7. trimLeft(character)
    String.prototype.trimLeft = function (character) {
      character = character || ' ';
      return this.replace(new RegExp('^[' + character + ']+'), "");
    };
    
  8. trimLeft(charlist = '\s')
    String.prototype.trimLeft = function(charlist = '\s') {
        return this.replace(new RegExp('^[' + charlist + ']+'), '');
    };
    
  9. lTrim()
    String.prototype.lTrim = function()
        return this.replace(/(^[\\s]*)/g, "");