NSPredicate that is the equivalent of SQL's LIKE

Posted by randombits on Stack Overflow See other posts from Stack Overflow or by randombits
Published on 2010-04-29T21:36:02Z Indexed on 2010/04/29 21:37 UTC
Read the original article Hit count: 504

I'm looking for a way to use NSPredicate to set a LIKE condition to fetch objects. In addition to that, an OR would be useful as well. I'm trying to do something where if a user searches "James" I can write an NSPredicate that will do the equivalent of:

select * from users where firstname LIKE '%James%' OR lastname LIKE '%James%';

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about core-data