In our UItableView search, we are using the below code to search a typed text in the cell content
NSComparisonResult result = [eachCellContent compare:searchText options:NSDiacriticInsensitiveSearch|NSCaseInsensitiveSearch range:NSMakeRange(0, [searchText length])];
This is working fine. But this is not working with korean text.
E.g:
suppose one of the cell text is “소”.//we are getting this combination by typing these two letters ㅅ and ㅗ
If we type ㅅ only , our compare method is not working and so not listing the “소”. (it is working if we type both ㅅ and ㅗ)
But the above example is working well with AddressBook application.
Is there any other compare method to support this ? (we also need this NSDiacriticInsensitiveSearch|NSCaseInsensitiveSearch )
Thanks to reading.
You could try to normalize the strings using
and then compare these.
UPDATE: The following algorithm worked in my test project:
In addition to decomposing the Unicode characters, the “trick” was to use a localized comparison.