Re: Core Data: case insensitive "equals" predicate strings!?
Re: Core Data: case insensitive "equals" predicate strings!?
- Subject: Re: Core Data: case insensitive "equals" predicate strings!?
- From: Ken Thomases <email@hidden>
- Date: Mon, 7 Jan 2008 16:22:02 -0600
On Jan 7, 2008, at 2:29 PM, Frank Reiff wrote:
I've had to resort to the very lame:
NSPredicate* predicate = [NSPredicate predicateWithFormat: @"%K
BEGINSWITH[c] %@ AND %K ENDSWITH[c] %@", @"fullDestinationPath",
newFullPath];
to get things to work properly.. surely this is not the recommended
way of doing case insensitive matching for core data?
I don't see an obvious case-insensitive equals operator. LIKE or
MATCHES are tempting, but get you in trouble if either of the
arguments include characters that are interpreted as meta-characters.
However, I would not use the BEGINSWITH AND ENDSWITH construction
that you're using. That would match if fullDestinationPath happened
to contain the concatenation of newFullPath with itself.
I think that something like A CONTAINS[c] B AND B CONTAINS[c] A would
be safer.
Still, you're right, it's far from elegant.
-Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden