Does anyone have a JavaScript that they use in IDM that will take in a string and replace all accented characters with their non-accented equivalents? I've found a few online in non-IDM forums, like Stack Overflow or GitHub, that claim to work but when I plug them into IDM, they don't work.
If anyone has such a script that they use and know will work in IDM, I'd appreciate the knowledge transfer.
Request clarification before answering.
Check this once.
// Main function:Z_removeAccent
function Z_removeAccent(Par) {
var map = {
'a': 'á|à|ã|â|À|Á|Ã|Â',
'e': 'é|è|ê|É|È|Ê',
'i': 'í|ì|î|Í|Ì|Î',
'o': 'ó|ò|ô|õ|Ó|Ò|Ô|Õ',
'u': 'ú|ù|û|ü|Ú|Ù|Û|Ü',
'c': 'ç|Ç',
'n': 'ñ|Ñ'
};
str = Par;
for (var pattern in map) {
str = str.replace(new RegExp(map[pattern], 'g'), pattern);
}
return str;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.