Nodejs String Trim Left trimLeft(character)

Here you can find the source of trimLeft(character)

Method Source Code

String.prototype.trimLeft = function (character) {
  character = character || ' ';
  return this.replace(new RegExp('^[' + character + ']+'), "");
};

Related

  1. ltrim()
    String.prototype.ltrim=function()
      {return this.replace(/^\s+/,'');}
    
  2. ltrim(ch)
    String.prototype.ltrim = function(ch) {
        var r = new RegExp("^{0}+".format(ch || "\\s"));
        return this.replace(r, "");
    };
    
  3. 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, '');
    };
    
  4. trimLeft()
    String.prototype.trimLeft = function() {
      return this.replace(/^\s+/, '');  
    };
    
  5. trimLeft()
    String.prototype.trimLeft = String.prototype.trimLeft || function() {
      return this.replace(/^\s+/,'');
    };
    
  6. trimLeft(charlist = '\s')
    String.prototype.trimLeft = function(charlist = '\s') {
        return this.replace(new RegExp('^[' + charlist + ']+'), '');
    };
    
  7. lTrim()
    String.prototype.lTrim = function()
        return this.replace(/(^[\\s]*)/g, "");
    
  8. lTrim()
    String.prototype.lTrim = function(){
      str = this;
       var i;
        for(i=0;i<str.length;i++)
            if(str.charAt(i)!=" "&&str.charAt(i)!=" ")break;
        str=str.substring(i,str.length);
        return str;
    ...
    
  9. lTrim()
    String.prototype.lTrim = function() {
      return this.replace(/(^\s*)/g, "");
    };