Documentation clarification - NSPredicate LIKE operator?
Documentation clarification - NSPredicate LIKE operator?
- Subject: Documentation clarification - NSPredicate LIKE operator?
- From: Jim Correia <email@hidden>
- Date: Wed, 15 Mar 2006 14:28:09 -0500
The documentation says:
LIKE
The left hand expression equals the right-hand expression
expanding ? and * characters as if shell globbing.
Can someone clarify what the behavior of * should be?
In practice, * isn't matching newlines, either in predicates
eventually used with CoreData, or in plain old Foundation code.
NSPredicate *likePredicate = [NSPredicate predicateWithFormat:
@"self LIKE[cd] %@", @"*foo*"];
NSLog(@"foobar matches = %d", [likePredicate evaluateWithObject:
@"foobar"]);
NSLog(@"foo\nbar matches = %d", [likePredicate evaluateWithObject:
@"foo\nbar"]);
Produces this output:
2006-03-14 22:39:25.104 PredicateAcrossRelationshipTest[25683] foobar
matches = 1
2006-03-14 22:39:25.105 PredicateAcrossRelationshipTest[25683] foo
bar matches = 0
Jim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden