谁能告诉我为什么当“程序”中有小写字符时returnSet返回为零
我已经完成了,NSLog 肯定会挑选出变量,但是当它 addObject: 它只是没有?
+ (NSSet *)variablesUsedInProgram:(id)program
{
NSMutableSet *returnSet = [[NSMutableSet alloc]init];
if ([program isKindOfClass:[NSArray class]]) {
[program enumerateObjectsUsingBlock: ^(id obj, NSUInteger idx, BOOL *stop)
{
if ([obj isKindOfClass:[NSString class]]) {
if ([obj rangeOfCharacterFromSet:[NSCharacterSet lowercaseLetterCharacterSet]].location != NSNotFound) {
NSLog(@"Variable: %@", obj);
[returnSet addObject:obj];
}
}
}];
}
return returnSet;
}