墨色风雨
一种选择:[NSString stringWithFormat:@"%@/%@/%@", one, two, three];另一种选择:我猜您对多个附加(a+b+c+d)不满意,在这种情况下您可以这样做:NSLog(@"%@", [Util append:one, @" ", two, nil]); // "one two"NSLog(@"%@", [Util append:three, @"/", two, @"/", one, nil]); // three/two/one使用类似的东西+ (NSString *) append:(id) first, ...{
NSString * result = @"";
id eachArg;
va_list alist;
if(first)
{
result = [result stringByAppendingString:first];
va_start(alist, first);
while (eachArg = va_arg(alist, id))
result = [result stringByAppendingString:eachArg];
va_end(alist);
}
return result;}