Created
          October 31, 2018 20:57 
        
      - 
      
 - 
        
Save andersonmadeira/4ea674e4b2b5ec866a2772ba812e0aff to your computer and use it in GitHub Desktop.  
    Retirar acentos
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | (function removerAcentos( string ) { | |
| var mapaAcentosHex = { | |
| a : /[\xE0-\xE6]/g, | |
| A : /[\xC0-\xC6]/g, | |
| e : /[\xE8-\xEB]/g, | |
| E : /[\xC8-\xCB]/g, | |
| i : /[\xEC-\xEF]/g, | |
| I : /[\xCC-\xCF]/g, | |
| o : /[\xF2-\xF6]/g, | |
| O : /[\xD2-\xD6]/g, | |
| u : /[\xF9-\xFC]/g, | |
| U : /[\xD9-\xDC]/g, | |
| c : /\xE7/g, | |
| C : /\xC7/g, | |
| n : /\xF1/g, | |
| N : /\xD1/g | |
| }; | |
| for ( var letra in mapaAcentosHex ) { | |
| var expressaoRegular = mapaAcentosHex[letra]; | |
| string = string.replace( expressaoRegular, letra ); | |
| } | |
| return string; | |
| })('àbÉstãdôÔ'); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment