Last active
April 20, 2017 13:11
-
-
Save dotenorio/f424cea548b11ebb7c645e3a5306ae92 to your computer and use it in GitHub Desktop.
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 removeAcentos (string) { | |
non_asciis = { | |
'a': '[àáâãäåª]', | |
'A': '[ÀÁÂÃÄÅ]', | |
'ae': 'æ', | |
'c': 'ç', | |
'C': 'Ç', | |
'e': '[èéêë]', | |
'E': '[ÈÉÊË]', | |
'i': '[ìíîï]', | |
'I': '[ÌÍÎÏ]', | |
'n': 'ñ', | |
'o': '[òóôõöº]', | |
'O': '[ÒÓÔÕÖ]', | |
'oe': 'œ', | |
'u': '[ùúûűü]', | |
'U': '[ÙÚÛŰÜ]', | |
'y': '[ýÿ]', | |
'Y': '[ÝŸ]' | |
}; | |
for (i in non_asciis) { string = string.replace(new RegExp(non_asciis[i], 'g'), i); } | |
return string; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment