Re: Searching in NSArray
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