开发者

Missing Terminating "" character & Unexpexted @ in the program

While writing the following code i got two errors :

1.Missing Terminating "" character 2.Unexpexted @ in the program "

Here after entering "HEllO" , "WORLD" is wriiten on the next line (i.e. after HELLO enter is pressed ).

    NSString *str = @"HELLO          --------> line 1
 开发者_开发问答                     WORLD";        --------> line 2

Does anyone knows solution to this error.


If you write string literal in several lines then each line must start and end with ":

NSString *str = @"HELLO"          --------> line 1
                  "WORLD";        --------> line 2

If you just want to display your text in several lines do what @jrturton suggests - add new line character ('\n') to your string


Do this instead:

NSString *str= @"HELLO\nWORLD";
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜