• 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
Re: Core Data: case insensitive "equals" predicate strings!?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Core Data: case insensitive "equals" predicate strings!?


  • Subject: Re: Core Data: case insensitive "equals" predicate strings!?
  • From: mmalc crawford <email@hidden>
  • Date: Tue, 8 Jan 2008 17:53:49 -0800


On Jan 8, 2008, at 4:22 PM, Ken Thomases wrote:

It's not clear what you're trying to achieve.
In what way does the LIKE operator not do what you want?

The concern I would have would be if his "newFullPath" variable contains characters which would be interpreted by the LIKE operator as wildcards. It's not as uncommon as one might guess that a file path contains "*" or "?".


You can escape the wildcards...

If you want to be really lazy:

string = [[string componentsSeparatedByString:@"*"]
			  componentsJoinedByString:@"\\*"];
string = [[string componentsSeparatedByString:@"?"]
			  componentsJoinedByString:@"\\?"];

Better (*) is to create a mutable copy of the string and modify it in place:

NSInteger i = [string length];
NSMutableString *string = [target mutableCopy];

for ( ; i >= 0 ; i-- )
{
    // ...

mmalc

(*) With thanks to MT.

_______________________________________________

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: Core Data: case insensitive "equals" predicate strings!?
      • From: Ken Thomases <email@hidden>
References: 
 >Core Data: case insensitive "equals" predicate strings!? (From: Frank Reiff <email@hidden>)
 >Re: Core Data: case insensitive "equals" predicate strings!? (From: Ken Thomases <email@hidden>)
 >Re: Core Data: case insensitive "equals" predicate strings!? (From: Frank Reiff <email@hidden>)
 >Re: Core Data: case insensitive "equals" predicate strings!? (From: mmalc crawford <email@hidden>)
 >Re: Core Data: case insensitive "equals" predicate strings!? (From: Ken Thomases <email@hidden>)

  • Prev by Date: PDF output: Adding keywords for spotlight?
  • Next by Date: Observing NSBrowser
  • Previous by thread: Re: Core Data: case insensitive "equals" predicate strings!?
  • Next by thread: Re: Core Data: case insensitive "equals" predicate strings!?
  • Index(es):
    • Date
    • Thread