Skip to content

Instantly share code, notes, and snippets.

@emoran
Created June 7, 2014 01:38
Show Gist options
  • Save emoran/998cebed19cacb2011e8 to your computer and use it in GitHub Desktop.
Save emoran/998cebed19cacb2011e8 to your computer and use it in GitHub Desktop.
function deleteAccent(str){
for (var i=0;i<str.length;i++){
//Change "á é í ó ú"
if (str.charAt(i)=="á") str = str.replace(/á/,"a");
if (str.charAt(i)=="é") str = str.replace(/é/,"e");
if (str.charAt(i)=="í") str = str.replace(/í/,"i");
if (str.charAt(i)=="ó") str = str.replace(/ó/,"o");
if (str.charAt(i)=="ú") str = str.replace(/ú/,"u");
}
return str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment