Как извлечь NSUInteger index из
NSUInteger index
NSRange range = [string rangeOfString: substring]
, чтобы я мог записать этот индекс в [array objectAtIndex:index]?
[array objectAtIndex:index]
// make sure that the substring was actually found: NSRange result = [string rangeOfString:substring]; if (result.location != NSNotFound) { // make sure that the index exists in the array if (result.location < [array count]) { id someObj = [array objectAtIndex:result.location]; // do something cool with someObj here } }
NSRange range = [string rangeOfString:substring]; NSUInteger index = range.location; //...