SergiusGee SergiusGee - 1 year ago 92
Objective-C Question

NSMutableArray check object at specific index

I have got an NSMutableArray before adding values to which I check if it's already there and I put this value at index 0.
However, if the value is already there, I would like to know it's there at the specific index.
This code doesn't work:

if ([theQueueArray containsObject:elementName atIndex:0])

How do you do it right, then?

Answer Source

Checking if an array "contains" an item at a specific index just sounds like a fancy way of stating the general case of accessing any item from an array at a given index, no?

if ([[theQueueArray objectAtIndex:0] isEqual:elementName]) {
    // ...

(If this isn't what you mean, consider clarifying the question.)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download