infinitered / cdq

Core Data Query for RubyMotion
MIT License
172 stars 35 forks source link

Support case insensitive queries #102

Open markrickert opened 9 years ago

markrickert commented 9 years ago

The NSPredicate format for doing this is appending [cd] to the end of the condition, for example:

# Would match "Mark" and "mark"
NSPredicate.predicateWithFormat("name CONTAINS[cd] %@", 'ar')

Thoughts on an api for this? Or should we just notate it in the documentation and people can create their own where() statements?

kemiller commented 9 years ago

You can do this with .where(:name).eq("ar", NSCaseInsensitivePredicateOption) which admittedly does not roll right off the tongue. We could make friendlier version with symbols.