在Objective-C中有没有(stringByAppendingString:)字符串连接的快捷方式,或者一般使用NSString的快捷方式?
例如,我想做:
NSString *myString = @"This";
NSString *test = [myString stringByAppendingString:@" is just a test"];
更像是:
string myString = "This";
string test = myString + " is just a test";
这样使用stringByAppendingString:
NSString *string1, *string2, *result;
string1 = @"This is ";
string2 = @"my string.";
result = [result stringByAppendingString:string1];
result = [result stringByAppendingString:string2];
OR
result = [result stringByAppendingString:@"This is "];
result = [result stringByAppendingString:@"my string."];