我想知道是否有可能执行以下操作:
我有这样的方法:
one = [[NSMutableArray alloc] initWithObjects:@"1",@"2",@"3", nil];
two = [[NSMutableArray alloc] initWithObjects:@"4",@"5",@"6", nil];
-(void)getStringAndChooseArray:(NSString *)nameOfArray {
//What i want to do is something like:
NSLog(@"The array %@ has got %i objects",nameOfArray,[nameOfArray count])
//Of course it is giving me an error since nameOfArray is a string..
//I know it is hard to understand,
//but what I'm trying to do is to call this method
//pass a string variable, which is named as one of the two arrays,
//and using it to do the rest..
}
如何使用字符串来识别数组并对其进行操作?
提前致谢 !