我遍历这样的数组。
NSArray *array = [[currentRaum raumattribute] allObjects];
NSString *compositeString = [ [ NSString alloc ] init ];
for( Raumattribute *attr in array ){
compositeString = [ NSString stringWithFormat:@"%@ %@",compositeString, attr.attributname ];
[raumAttributLabel setText:compositeString];
我想要这样的输出----> Cat,Dog,Mouse
但如果我这样做:
compositeString = [ NSString stringWithFormat:@"%@ %@,",compositeString, attr.attributname ];
输出是猫,狗,老鼠,
或者如果我这样做:
compositeString = [ NSString stringWithFormat:@"%@ ,%@",compositeString, attr.attributname ];
输出它的 ,Cat,Dog,Mouse
有解决办法吗?