I have a NSMutableArray that I need to search for a string and return the key in the array where the string was found. So for example if I'm searching "ipod" and it's the 4th in the array, it would return 3 or whatever position the string is in. What's the best way to do this?
+2
A:
return [theArray indexOfObject:@"ipod"];
Note that NSMutableArray inherits from NSArray, so any NSArray methods can be used on NSMutableArray too.
KennyTM
2010-04-09 18:40:28
Would you know how to do it with objects within the array? For example I'm using the XMLParser and would want to know where the word iPod is located in a sub object.
Raphael Caixeta
2010-04-09 18:48:49