Skip to content

Instantly share code, notes, and snippets.

@devrsantos
Created November 2, 2018 01:29
Show Gist options
  • Save devrsantos/44013b12efbd92f2b7ced7b9a5922316 to your computer and use it in GitHub Desktop.
Save devrsantos/44013b12efbd92f2b7ced7b9a5922316 to your computer and use it in GitHub Desktop.
function removeAcento(text)
{
text = text.toLowerCase();
text = text.replace(new RegExp('[ÁÀÂÃ]','gi'), 'a');
text = text.replace(new RegExp('[ÉÈÊ]','gi'), 'e');
text = text.replace(new RegExp('[ÍÌÎ]','gi'), 'i');
text = text.replace(new RegExp('[ÓÒÔÕ]','gi'), 'o');
text = text.replace(new RegExp('[ÚÙÛ]','gi'), 'u');
text = text.replace(new RegExp('[Ç]','gi'), 'c');
return text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment