Nodejs String Trim Left TrimStart( aimStr )

Here you can find the source of TrimStart( aimStr )

Method Source Code

String.prototype.TrimStart = function( aimStr )
{
    var str = this;
    var re = My.RegExp.InvolvedCharsRegExp;
    var reStart;//  ww  w.  ja v  a 2  s.c om
    if ( aimStr )
    {
        aimStr = aimStr.replace( re, '\\$1' );
        reStart = new RegExp( '^(' + aimStr + ')+' );
    }
    else reStart = /^\s+/;
    str = str.replace( reStart, '' );
    return str;
};

Related

  1. lTrim(charlist)
    String.prototype.lTrim = function(charlist) {
      if (charlist === undefined)
        charlist = "\s";
      return this.replace(new RegExp("^[" + charlist + "]+"), "");
    };
    
  2. leftTrim()
    String.prototype.leftTrim = function () {
        return this.replace(/^\s+/, "");
    
  3. leftTrim()
    String.prototype.leftTrim = function() { 
       return this.replace(/(^\s*)/g, ""); 
    
  4. leftTrim()
    String.prototype.leftTrim =function(){
        return this.replace(/^\s+/,'');
    
  5. lefttrim( )
    String.prototype.lefttrim = function( )
      return( this.replace(new RegExp("^[\\s]+", "gm"), "") );
    };
    
  6. LTrim()
    String.prototype.LTrim = function(){
      return this.replace(/(^\s*)/g, "");
    };
    
  7. LTrim()
    String.prototype.LTrim = function() {
        return this.replace(/^\s+/g, "");