Remove substring from a string - Node.js String

Node.js examples for String:sub string

Description

Remove substring from a string

Demo Code

String.prototype.remove = function( start, length )
{
  var s = '' ;
  
  if ( start > 0 )
    s = this.substring( 0, start ) ;/*  w  w  w .  j ava 2 s  .com*/
  
  if ( start + length < this.length )
    s += this.substring( start + length , this.length ) ;
    
  return s ;
}

Related Tutorials