raaz
raaz

Reputation: 12490

How to check if a NSMutableArray contains a value (null) or not?

I have an NSMutableArray instance which contains "N" number of objects and I want to check whether NSMutableArray contains a (null) or any other value.

In NSString there is a method called isEqualToString: Is there a similar method available for NSMutableArray?

Or otherwise, how can I do this?

Upvotes: 2

Views: 11419

Answers (1)

walkytalky
walkytalky

Reputation: 9543

NSMutableArray can only contain non-nil objects. Objects that print as (null) are typically nil.

The superclass method containsObject: will tell you whether a particular non-nil object is in the array. Note that this will only work if the objects are identical according to isEqual:.

Upvotes: 9

Related Questions