I need to use NSPredicate to match two strings, case-insensitive, diacritic insensitive, and whitespace-insensitive.
The predicate would look something like this:
[NSPredicate predicateWithFormat:@"Key ==[cdw] %@", userInputKey];
The 'w' modifier is an invented one to express what I'd like to use.
I can't just trim the userInputKey
because the data-source "Key" values might have whitespaces in them too (they need those whitespaces, I can't just trim them beforehand).
For example, given a userInputKey
"abc" the predicate should match all of
{"abc", "a b c", " a B C "}and so on. Given a
userInputKey
"a B C" the predicate should also match all the values in the set above.
This can't be so hard to do, can it?