I'm not sure if this is what you're looking for, but Objective-C 2.0 has
this:
NSArray *a = [NSArray arrayWithObjects:@"Hello",@"Goodbye",nil];

for (NSString *s in a) {
     if ([s isEqualToString:@"Goodbye"]) {
        NSLog(@"it is equal");
    }
}

And you can have an additional int (or NSInteger) counter to keep track of
which object it is.

Oh, you could also do [NSArray indexOfObject:]. if it returns NSNotFound,
it's not in the array.

On Fri, Jun 5, 2009 at 11:36 AM, Pierce Freeman <piercefreema...@comcast.net
> wrote:

> Hi Everyone:
>
> I am most likely overlooking this function, but I just can't seem to find
> it
> in the documentation.  I am looking for some way to search an NSArray
> listing for one string that is part of multiple objects in the array.  This
> search then returns the number of objects that contained that string in it.
> I imagine this would be built into NSArray, so if anyone could steer me in
> the right direction, it would be greatly appreciated!
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/kthemank%40gmail.com
>
> This email sent to kthem...@gmail.com
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to