These are all valid ways to split a string across multiple lines:
Code:
NSString *s = @"this" \
@" is a" \
@" very long" \
@" string!";
NSLog(s);
NSString *s1 = @"this"
@" is a"
@" very long"
@" string!";
NSLog(s1);
NSString *s2 = @"this"
" is a"
" very long"
" string!";
NSLog(s2);
NSString *s3 = @"this\
is a\
very long\
string!";
NSLog(s3);
The last one is probably the worst; it's hardest to understand what's in the string and what isn't, and it will break your indenting.
I prefer this one:
Code:
NSString *s2 = @"this"
" is a"
" very long"
" string!";
It's short and sweet. They all do the same thing, though.