鉴于此:
NSString *innerXml = @"somevalue";
NSMutableString *xml = [[NSMutableString alloc] init];
其中哪一个更快; 不询问可读性,这是主观的:
1
[xml appendFormat:@"<randomElement>%@</randomElement>", innerXml];
2
[xml appendString:@"<randomElement>"];
[xml appendString:innerXml];
[xml appendString:@"</randomElement>"];