• 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
NSPredicate and NSString with whitespace gives runtime error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSPredicate and NSString with whitespace gives runtime error


  • Subject: NSPredicate and NSString with whitespace gives runtime error
  • From: Koen van der Drift <email@hidden>
  • Date: Mon, 22 Apr 2013 10:58:17 -0400

Is there a way I can use an NSPredicate to search an NSString that contains whitespaces (a sentence)?  If I use this:

	NSPredicate *functionPredicate = [NSPredicate predicateWithFormat: @"function CONTAINS[cd] %@", searchString];

I keep getting a runtime error:

	'NSInvalidArgumentException', reason: 'Unable to parse the format string "function CONTAINS[cd] %@"'


My guess is this happens because the attribute contains whitespace, since I have a bunch of similar NSPredicates that searches one-word attributes, and I don't get the error.

Thanks,

- Koen.



_______________________________________________

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

  • Follow-Ups:
    • Re: NSPredicate and NSString with whitespace gives runtime error
      • From: Ben Gollmer <email@hidden>
  • Prev by Date: Re: Third time I ask - please help. How to trace visible change in a UIView (UIWebView)
  • Next by Date: Re: NSPredicate and NSString with whitespace gives runtime error
  • Previous by thread: Re: Third time I ask - please help. How to trace visible change in a UIView (UIWebView)
  • Next by thread: Re: NSPredicate and NSString with whitespace gives runtime error
  • Index(es):
    • Date
    • Thread