Reputation: 1359
How do i get index value from NSMutableArray.
I got NSString *stringValue=@"e";
And my NSMutableArray *arrayValue=[[NSMutableArray alloc]init];
[arrayValue addobject:@"a"];
[arrayValue addobject:@"b"];
[arrayValue addobject:@"c"];
[arrayValue addobject:@"d"];
[arrayValue addobject:@"e"];
[arrayValue addobject:@"f"];
[arrayValue addobject:@"g"];
I want to get array index value based on string value.
How to do
@thanks in advance.
Upvotes: 3
Views: 4117
Reputation: 8001
Since NSMutableArray
is a NSArray
subclass, all the methods are also inherited. You're looking for the indexOfObject:
function
Upvotes: 1
Reputation: 4649
Wow, a quick look at the documentation ?
NSUInteger index = [ar indexOfObject:@"e"];
Upvotes: 9