• 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: Searching in NSArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Searching in NSArray


  • Subject: Re: Searching in NSArray
  • From: Kyle Sluder <email@hidden>
  • Date: Fri, 5 Jun 2009 09:02:15 -0700

On Fri, Jun 5, 2009 at 8:56 AM, Pierce
Freeman<email@hidden> wrote:
> This looks like an interesting lead, I'll look into it later.

Not to discourage you from reading the documentation, but this is how
you would use it:

-(NSArray *)itemsInArray:(NSArray *)inArray
containingSubstring:(NSString *)substring {
  return [inArray filteredArrayUsingPredicate:[NSPredicate
predicateWithFormat:@"SELF CONTAINS[cd] %@", substring]];
}

The predicate format string is described in the Predicate Programming
Guide.  Of specific importance are the c and d modifiers applied to
the CONTAINS operator: they mean case-insensitive and
diacritic-insensitive respectively.

--Kyle Sluder
_______________________________________________

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

References: 
 >Re: Searching in NSArray (From: Kyle Sluder <email@hidden>)
 >Re: Searching in NSArray (From: Pierce Freeman <email@hidden>)

  • Prev by Date: Re: Making an NSButton appear selected.
  • Next by Date: Re: Hiding Glyphs
  • Previous by thread: Re: Searching in NSArray
  • Next by thread: detecting the in-line microphone switch
  • Index(es):
    • Date
    • Thread