Re: Checking One Array Against Another
Re: Checking One Array Against Another
- Subject: Re: Checking One Array Against Another
- From: Pierce Freeman <email@hidden>
- Date: Fri, 28 Nov 2008 20:41:21 -0800
- Thread-topic: Checking One Array Against Another
Adam:
Would this work even if the two arrays weren't in the same order?
Sincerely,
Pierce F
--
Pierce Freeman
email@hidden
On 11/28/08 8:35 PM, "Adam R. Maxwell" <email@hidden> wrote:
>
> On Nov 28, 2008, at 8:25 PM, Pierce Freeman wrote:
>
>> Hi everyone.
>>
>> I am attempting to check one array's contents against another's, but
>> so far
>> it hasn't been working. In the actual application, I am checking the
>> current open applications against an "okay" application list, and just
>> thought of another problem: If the user doesn't have an application
>> open
>> that is on the list, it will think the reverse. Some example code
>> (with
>> different variables) is below:
>
> Have you considered using NSSet for this?
>
> NSSet *openSet = [NSSet setWithArray:openApplications];
> NSSet *allowedSet = [NSSet setWithArray:allowedApplications];
>
> if ([openSet isSubsetOfSet:allowedSet])
> // do something
>
> --
> Adam
_______________________________________________
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