NSArray *array = @[ @"22.298166 , 73.165809",
@"22.300598 , 73.167183",
@"22.298101 , 73.166188",
@"22.298128 , 73.166194",
@"22.298130 , 73.166194"];
知る必要がある場合、それが配列内にあるかどうか:
NSString *searchString = @"22.298130 , 73.166194";
BOOL found = [[array subarrayWithRange:NSMakeRange([array count]-3, 3)] containsObject:searchString];
NSLog(@"%@", (found) ? @"YES" : @"NO");
インデックスを知る必要がある場合は、次のことができます
[[array subarrayWithRange:NSMakeRange([array count]-3, 3)] enumerateObjectsUsingBlock:^(NSString *obj, NSUInteger idx, BOOL *stop) {
if ([obj isEqualToString:searchString]) {
*stop = YES; //avoid further loops, if we had a positive hit.
NSLog(@"%lu %lu", idx, [array count]-3+idx); //index in subarray and in original array
};
}];