Nodejs String Remove removeAccents()

Here you can find the source of removeAccents()

Method Source Code

String.prototype.removeAccents = function() {
  var diacritics = [
      [/[\300-\306]/g, 'A'],
      [/[\340-\346]/g, 'a'],
      [/[\310-\313]/g, 'E'],
      [/[\350-\353]/g, 'e'],
      [/[\314-\317]/g, 'I'],
      [/[\354-\357]/g, 'i'],
      [/[\322-\330]/g, 'O'],
      [/[\362-\370]/g, 'o'],
      [/[\331-\334]/g, 'U'],
      [/[\371-\374]/g, 'u'],
      [/[\321]/g, 'N'],
      [/[\361]/g, 'n'],
      [/[\307]/g, 'C'],
      [/[\347]/g, 'c'],
  ];//ww w .  j  a v a  2  s  . c  o  m
  var s = this;
  for (var i = 0; i < diacritics.length; i++) {
      s = s.replace(diacritics[i][0], diacritics[i][1]);
  }
  return s;
};

Related

  1. remove( start, length )
    String.prototype.remove = function( start, length )
      var s = '' ;
      if ( start > 0 )
        s = this.substring( 0, start ) ;
      if ( start + length < this.length )
        s += this.substring( start + length , this.length ) ;
      return s ;
    
  2. remove(idx)
    String.prototype.remove = function (idx) {
      var arr = this.split("");
      arr.splice(idx, 1);
      arr = arr.join('');
      arr = arr.toString();
      return arr;
    
  3. remove(substr)
    String.prototype.remove = function (substr) {
      return this.replace(substr, '');
    };
    
  4. removeAccents()
    String.prototype.removeAccents = function(){
        return this
            .toLowerCase()
            .replace(/[?gi,"a")
            .replace(/[?gi,"e")
            .replace(/[?gi,"i")
            .replace(/[?/gi,"o")
            .replace(/[?gi, "u")
            .replace(/[^a-zA-Z0-9]/g," ");
    ...
    
  5. removeAllSpaces()
    String.prototype.removeAllSpaces = function () {
        return this.split(' ').join('');
    
  6. removeBlackLines()
    String.prototype.removeBlackLines = function () {
        return this.replace(/\n[\s\t]*\r*\n/g, '\n');
    };
    
  7. removeBr()
    String.prototype.removeBr = function()
      return this.replace(/(<br \/>|<br>)/g, '');
    };
    
  8. removeBreakLine()
    String.prototype.removeBreakLine = function() { 
      return this.replace(/(\r\n|\n|\r)/gm," ");