Reputation: 867
Here is the string from NSMutableArray:
(
(
"Some String Value"
)
)
This code displays the string value that I want, but however, it displays with the brackets and quotes. How do I remove them?
Thank you in advance!!
Upvotes: 0
Views: 445
Reputation: 1542
-(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]]];
}
}
}
Upvotes: 0
Reputation: 46563
In your case it is 2D Array:
Something like this:
NSArray *arr=[NSArray arrayWithObject:@"asdf"];
NSArray *arr2=[NSArray arrayWithObjects:arr, nil];
You need to go to 2nd level to retrive it as :
NSLog(@"=> %@",arr2[0][0]);
NSString *string=arr2[0][0];
Upvotes: 1