Re: Predicate expressions
Re: Predicate expressions
- Subject: Re: Predicate expressions
- From: "Kyle Sluder" <email@hidden>
- Date: Sun, 1 Jun 2008 15:26:05 -0400
On Sat, May 31, 2008 at 4:57 PM, Fabian <email@hidden> wrote:
> NSArray *arrayB = [self getObjects] ;
>
> NSArray *titles = [arrayB arrayByApplyingSelector:@selector(title)];
> NSArray *subtitles = [arrayB arrayByApplyingSelector:@selector(subtitle)];
>
> NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(title IN
> %@) AND (subtitle IN %@)", titles, subtitles];
> NSArray *result = [arrayA filteredArrayUsingPredicate:predicate];
I am *really* confused as to what you're trying to do here. You have
asked the NSArray for all objects from array B whose title is in the
collection of all titles of objects in array B and whose subtitle is
in the collection of all subtitles of objects in array B. Basically,
you have said "give me all the objects."
Given you description of what you want to do, though, it sounds like
you're trying to find duplicates, as far as the title and subtitle are
concerned?
--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