【发布时间】:2010-02-05 06:30:52
【问题描述】:
如何在 Objective-C 中的特定索引处打印数组元素?我的代码如下所示:
NSString *String=[NSString StringWithContentsOFFile:@"/User/Home/myFile.doc"];
NSString *separator = @"\n";
NSArray *array = [String componetntsSeparatedByString:separator];
NSLog(@"%@",array);
我可以一次打印数组的全部内容,但我想将每个索引处的元素分配到一个字符串中,比如...
str1=array[0];
str2=array[1];
str3=array[0];...this continues
我该怎么做?
【问题讨论】:
-
嘿,我得到了答案......对不起......它的 NSLog(@"%@",[array objectAtIndex:index]);
标签: objective-c arrays nsarray