这是来自 NSMutableArray 的字符串:
(
(
"Some String Value"
)
)
此代码显示我想要的字符串值,但是,它显示时带有括号和引号。如何删除它们?
先感谢您!!
这是来自 NSMutableArray 的字符串:
(
(
"Some String Value"
)
)
此代码显示我想要的字符串值,但是,它显示时带有括号和引号。如何删除它们?
先感谢您!!
在您的情况下,它是二维数组:
像这样的东西:
NSArray *arr=[NSArray arrayWithObject:@"asdf"];
NSArray *arr2=[NSArray arrayWithObjects:arr, nil];
您需要进入第二级以将其检索为:
NSLog(@"=> %@",arr2[0][0]);
NSString *string=arr2[0][0];
-(void)repeatArray:(NSArray *)array1 {
static NSMutableString *InsideString; // Better to use global Varaible declared in ViewDidLoad/loadView
NSArray *array = array1; //Its your array
for (int i = 0; i< [array count]; i++) {
if ([[array objectAtIndex:i] isKindOfClass:[NSArray class]]) {
[self repeatArray:[array objectAtIndex:i]];
} else if ([[array objectAtIndex:i] isKindOfClass:[NSString class]]) {
[InsideString appendString:[NSString stringWithFormat:@"%@ ", [array objectAtIndex:i]]];
}
}
}