Created
October 22, 2015 14:44
-
-
Save dmiro/dadf9d6ecd9fbb6add5f 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
| var normalizarTexto = function(texto){ | |
| var accents = { | |
| 'à':'a','á':'a','â':'a','ã':'a','ä':'a','å':'a','æ':'e','è':'e','é':'e','ê':'e','ë':'e','ì':'i', | |
| 'í':'i','î':'i','ò':'o','ó':'o','ô':'o','ö':'o','ù':'u','ú':'u','û':'u','ü':'u','ñ':'n' | |
| }; | |
| texto = texto.toLowerCase(); | |
| texto = texto.replace(/[àáâãäåæèéêëìíîòóôöùúûüñ]/gi, function(m){return accents[m];}); | |
| texto = texto.replace(/\s/gi,""); | |
| return texto; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment