Skip to content

Instantly share code, notes, and snippets.

@vhsu
Forked from alisterlf/gist:3490957
Last active May 25, 2018 12:41
Show Gist options
  • Save vhsu/ea1e832262265b93d87528819caa1062 to your computer and use it in GitHub Desktop.
Save vhsu/ea1e832262265b93d87528819caa1062 to your computer and use it in GitHub Desktop.
JAVASCRIPT:Remove Accents
//Lowercase Only Version
function RemoveAccents(strAccents) {
var strAccents = strAccents.split('');
var strAccentsOut = new Array();
var strAccentsLen = strAccents.length;
var accents = 'àáâãäåòóôõöøèéêëðçÐìíîïùúûüñšÿýž';
var accentsOut = "aaaaaaooooooeeeeecdiiiiuuuunsyyz";
for (var y = 0; y < strAccentsLen; y++) {
if (accents.indexOf(strAccents[y]) != -1) {
strAccentsOut[y] = accentsOut.substr(accents.indexOf(strAccents[y]), 1);
} else
strAccentsOut[y] = strAccents[y];
}
strAccentsOut = strAccentsOut.join('');
return strAccentsOut;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment