开发者

Are multiple lines in a header file allowed for text / strings?

开发者 https://www.devze.com 2022-12-31 21:18 出处:网络
I want to do this: #define kDescriptionText @\"Some text here...\" \"...and more continued here.\" I\'ve also tried:

I want to do this:

#define kDescriptionText @"Some text here..."
"...and more continued here."

I've also tried:

@"...and more continued here."

Is this possible? Or 开发者_如何学Gomust it all be on one looooooong line?


Use a backslash, as in here:

NSLog(@"Some text here...\
Some text here...");


Since I can't put code in a comment, here's Paul's suggestion for the define

#define BLAH @"this is a \ 
long string"

which worked for me.
Make sure there are no characters (including spaces) after the backslash.


I prefer:

#define FOO @"hgdhjdlhd" \
             "gfgfgfd"

Or

NSString* const kFoo = @"gfsdhg"
                        "grgfsdgfsd";
0

精彩评论

暂无评论...
验证码 换一张
取 消