本文介绍了缺少终止“"品格程序中未扩展的@的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在编写以下代码时,我遇到两个错误:
While writing the following code i got two errors :
1.缺少终止"字符2.在程序"
1.Missing Terminating "" character2.Unexpexted @ in the program "
在此处输入"HELLO"后,在下一行(即,在按HELLO enter键之后)会写上"WORLD".
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
如果您只想在多行中显示文本,请执行@jrturton的建议-在字符串中添加新的行字符('\ n'
)
If you just want to display your text in several lines do what @jrturton suggests - add new line character ('\n'
) to your string
这篇关于缺少终止“"品格程序中未扩展的@的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!