I am using string search "rangeOfString" method available in NSString class. If the string to search and the search string both are in English, I'm able to perform the search perfectly. But if the search string has german characters like umlauts and accents (like German characters Ä,Ö,Ü) I'm not able to compare. Can some one suggest me the correct method to compare/search English and German characters?

有帮助吗?

解决方案

Use NSDiacriticInsensitiveSearch option while using the compare/rangeOfString method. Check the documentation here.

NSDiacriticInsensitiveSearch:

Search ignores diacritic marks.

For example, ‘ö’ is equal to ‘o’.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top