views:

268

answers:

1

Hi all,

I have a NSMuatableArray object which contains "N" number of objects and i want to check wheather mutablearray contains (null) value or any othervalue.

In NSString there is an method called isEqualToString: Wheather any simmilar method available for NSMutableArray?

How can i do this?

+1  A: 

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:.

walkytalky
Hi walkytalky,Thanx for reply but if i have a (null) i.e a value of emptystring then how can i check?
raaz
An empty string will not print as `(null)`. If it does, it's `nil` and you don't have to look for it in the array because it can't be there. (Okay, it could also be `@"(null)"` -- you can test for this with `containsObject:` as added above -- but that's pretty unlikely. Unless you're wilfully defining that string just to confuse yourself?)
walkytalky
yes walkytalky you are correct when i print my mutablearray with CFShow(mutablearray); it shows exactly what you said.It is simply nil.Thanks for help.
raaz