Nodejs String Remove removelinks()

Here you can find the source of removelinks()

Method Source Code

String.prototype.removelinks = function() {
   var regexp = /<a [^>]*>(.*)<\/a>/gi;
   return this.replace(regexp, '$1');
};

Related

  1. removeSubstring(char,occurance)
    String.prototype.removeSubstring = function(char,occurance) 
      var temp='';
      if(occurance==undefined)
        for (var i = 0; i < this.length; i++) 
          if(char!==this[i])
            temp+=this[i];
      else
        var flag = true;
        var ct=parseInt("0");
        for (var i = 0; i < this.length ; i++) 
          if(char===this[i])
            ct++;
            flag=(ct===parseInt(occurance))?false:true;
          else
            temp+=this[i];
          if(!flag)
            temp+=this.substr(i+1,this.length);
            return temp;
      return temp;
    };
    var str1 = 'aaa';
    console.log(str1.removeSubstring('a', 2)); 
    var str2 = 'aaabbbb'; 
    console.log(str2.removeSubstring('a'));
    
  2. removeSubstring(start, length)
    String.prototype.removeSubstring = function(start, length) {
        return this.substr(0, start) + this.substr(start + length);
    };
    
  3. removeTrailingSlash()
    String.prototype.removeTrailingSlash = function() {
      if(this.endsWith('/')) {
        return this.substring(0, this.length-1);
      return this;
    
  4. removeWhiteSpace()
    String.prototype.removeWhiteSpace = function() {
        return this.replace(/\s/g, "");
    };
    
  5. removeWhitespace()
    String.prototype.removeWhitespace = function() {
        return this.replace(/(\s)/gm, '');
    };