Nodejs String Trim Left ltrim()

Here you can find the source of ltrim()

Method Source Code

String.prototype.ltrim = function() {
   return this.replace(/(^\s*)/g, "");
}

Related

  1. ltrim()
    String.prototype.ltrim = function() {
        return this.replace(/^\s+/,"");
    };
    
  2. ltrim()
    String.prototype.ltrim = function() {
      return this.replace(/^\s+/g,"");
    
  3. ltrim()
    var s1 = new String('  A  B  ');
    String.prototype.ltrim = function(){
      var regexp = /^\s*/;
      var result = this.replace(regexp, '');
      return result;
    };
    console.log('||'+s1.ltrim()+'||');
    
  4. ltrim()
    String.prototype.ltrim = function() {
      return this.replace(/^\s*/g,'');
    
  5. ltrim()
    String.prototype.ltrim=function()
      return this.replace(/(^\s*)/g,'');
    
  6. ltrim()
    String.prototype.ltrim = function() {
      return this.replace(/^\s+/,'');
    
  7. ltrim()
    String.prototype.ltrim = function(){
      return this.replace(/\s+$/, "");
    };
    
  8. ltrim()
    String.prototype.ltrim = function(){
      return this.replace(/^\s+/, "");
    };
    
  9. ltrim()
    String.prototype.ltrim = function()
      return this.replace( /^\s*/g, '' ) ;