int main (int argc, const char * argv[])
{
@autoreleasepool {
// insert code here...
NSLog(@"Hello, World!");
NSArray *array = [NSArray arrayWithObjects:@"Ray", @"Summer", nil];
[array enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
NSLog(@"object at index %lu is %@", idx, obj);
}];
NSIndexSet *indices = [array indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) {
NSRange match = [obj rangeOfString:@"Ray"];
if (match.location == NSNotFound)
{
return NO;
}
else
{
return YES;
}
}];
NSLog(@"%@", indices);
}
return 0;
}