checking if an array doesn't contain a certain object

Alex Stelea picture Alex Stelea · Aug 21, 2010 · Viewed 51.3k times · Source

is there a class available to check if an array doesn't contain an object? I want to do something like

if [(myarray doesntContain @"object")]

is this possible

Answer

Georg Fritzsche picture Georg Fritzsche · Aug 21, 2010

For NSArray use -containsObject::

if (![myarray containsObject:someObject]) {
    // ...
}