String Format
String Format
How to format a string to remove the accent. I need to leave it in lowercase and without accents, to make it lowercase I use StringLower but to remove the accent?
Re: String Format
You could use StrReplace() with a for loop to loop through an associative array of accented characters and their replacements as key-value pairs.
Re: String Format
Example:
Code: Select all
MsgBox, % UnAccent("móstrame qué hacer")
return
UnAccent(str) {
static chars := {"á": "a", "é": "e", "í": "i", "ó": "o", "ü": "u", "ñ": "n"}
for accented, unaccented in chars
str := StrReplace(str, accented, unaccented)
return str
}
Re: String Format
I think this code by lexikos can help to remove the diacritics: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=8089#p47548
Re: String Format
Thanks for that, gregster. Looks like I was thinking along the same lines as another poster in that thread.