Hello,
I’m trying to find an ASOC way to replace diacriticals characters with their equivalent without diacriticals in an NSString. But I can’t find any method that will help me accomplish that. I know there is a stringByTrimmingCharactersInSet: method, but I do not wish to remove them, I want to switch them.
I had a routine in ASS that worked fine, basically what it did is run through a list of characters and if it hit a match it would replace this character with a character in a replacement list at the same position. That did the trick, but I thought there might be a nice method somewhere that would do that. If nothing exists i’ll update it to be ASOC compatible, but i’d rather use whatever is already there.
I have 2 NSCharacterSet defined, ready to use:
set diacriticalsCharSet to current application's NSCharacterSet's characterSetWithCharactersInString_("áà âäãåçéèêëÃìîïñóòôöõúùûüÿÃÀÂÄÃÅÇÉÈÊËÃÌÎÃÑÓÒÔÖÕÚÙÛÜŸ")
set replacementCharSet to current application's NSCharacterSet's characterSetWithCharactersInString_("aaaaaaceeeeiiiinooooouuuuyAAAAAACEEEEIIIINOOOOOUUUUY")
I’ve also looked at NSScanner and it does have a method that would do the trick but it requires pointers, so can’t use it in ASOC.
Anyone has a pointer? Or maybe I am looking in the wrong direction?
Thanks!
Browser: Safari 531.22.7
Operating System: Mac OS X (10.6)