[英]Newline in Objective C using Xcode 4.4
Has anyone had an issue besides me where /n didn't produce a new line in an output string? 除了我以外,还有没有人在输出字符串中不产生新行的问题? This is a starter program taken from "Programming in Objective C" Fourth Edition by Stephen Kochan. 这是一个启动程序,摘自Stephen Kochan撰写的“ Objective C中的编程”第四版。 The code runs without error but prints /n instead of advancing a line which is contrary to the text. 该代码运行时没有错误,但显示/ n而不是前进与文本相反的行。 Is there an Xcode dialog setting I need to look at or something? 我需要查看Xcode对话框设置吗?
Thanks, 谢谢,
Michael 麦可
// First programming example
#import <'Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
// insert code here...
NSLog(@"Testing..../n....1/n....2/n....3");
}
return 0;
}
Objective-C(以及许多其他编程语言...)中的换行符不是\\n
/n
。
Escaping characters is when you use a backslash, not a forward slash, a new line is: \\n
and a carriage return is \\r
转义字符是使用反斜杠而不是正斜杠时的换行符,换行符是: \\n
而回车符是\\r
/n
is just... well "/n" /n
只是...好吧/ n
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.