Domanda

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?

È stato utile?

Soluzione

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

NSDiacriticInsensitiveSearch:

Search ignores diacritic marks.

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top