• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Documentation clarification - NSPredicate LIKE operator?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Documentation clarification - NSPredicate LIKE operator?
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: Help on NSToolbar
  • Next by Date: Re: Getting a bullet into a NSString
  • Previous by thread: Re: Parsing a string into a NSDate
  • Next by thread: Re: Documentation clarification - NSPredicate LIKE operator?
  • Index(es):
    • Date
    • Thread