Are there any shortcuts to (stringByAppendingString:
) string concatenation in Objective-C, or shortcuts for working with NSString
in general?
Either of these formats work in XCode7 when I tested:
NSString *sTest1 = {@"This" " and that" " and one more"};
NSString *sTest2 = {
@"This"
" and that"
" and one more"
};
NSLog(@"\n%@\n\n%@",sTest1,sTest2);
For some reason, you only need the @ operator character on the first string of the mix.
However, it doesn't work with variable insertion. For that, you can use this extremely simple solution with the exception of using a macro on "cat" instead of "and".