是必须用到c吗?
运行结果是对了,但是不知道是不是不符合题的要求
NSArray *a = @[@"a1", @"a2"];
NSArray *b = @[@"b1", @"b2", @"b3"];
NSArray *c = @[a, b];
NSMutableString *str = [NSMutableString stringWithString:@""];
for (id obja in a)
{
for (id objb in b)
{
[str appendFormat:@"%@%@", obja, objb];
if ([a indexOfObject:obja] == a.count - 1 && [b indexOfObject:objb] == b.count - 1)
{
[str appendFormat:@";"];
}
else
[str appendFormat:@","];
}
}
NSLog(@"%@", str); |