NSArray indexOfObjectIdenticalTo inRange
- (NSUInteger)indexOfObjectIdenticalTo:(id)anObject inRange:(NSRange)range
Parameters
anObject
An object.
range
The range of indexes in the array within which to search for anObject.
Return Value
The lowest index within range whose corresponding array value is identical to anObject. If none of the objects within range is identical to anObject, returns NSNotFound.
Discussion of [NSArray indexOfObjectIdenticalTo inRange]
Objects are considered identical if their object addresses are the same.
NSArray indexOfObjectIdenticalTo inRange example.
NSArray* arrFruits = [NSArray arrayWithObjects:@"Apple", @"Orange", @"Banana", @"Watermelon", @"Cherry", @"Strawberry", @"Pineapple", nil];
idx = [arrFruits indexOfObjectIdenticalTo:@"Banana"];
idx = [arrFruits indexOfObjectIdenticalTo:@"Cherry" inRange:NSMakeRange(0, 5)];
idx = [arrFruits indexOfObjectIdenticalTo:@"Banana"];
idx = [arrFruits indexOfObjectIdenticalTo:@"Cherry" inRange:NSMakeRange(0, 5)];
Example of [NSArray indexOfObjectIdenticalTo inRange].
- (NSUInteger)indexOfObjectIdenticalTo:(id)anObject inRange:(NSRange)range;
NSLog(@"%lu", [demo indexOfObjectIdenticalTo:@"two" inRange:NSMakeRange(2, 1)]);
NSLog(@"%lu", [demo indexOfObjectIdenticalTo:@"two" inRange:NSMakeRange(2, 1)]);