<分区>
Possible Duplicate:
What is the difference between \r and \n?
我真的很想知道 \n
, \r
, \t
, chr(13) 之间有什么区别
,它们如何在 Web 应用程序中使用,在哪个操作系统中使用,等等。
例如,您能否确认 Windows 使用 \n\r
作为换行符,而 linux 使用 \n
对吗?了解这些事情会很有趣。
谢谢
<分区>
Possible Duplicate:
What is the difference between \r and \n?
我真的很想知道 \n
, \r
, \t
, chr(13) 之间有什么区别
,它们如何在 Web 应用程序中使用,在哪个操作系统中使用,等等。
例如,您能否确认 Windows 使用 \n\r
作为换行符,而 linux 使用 \n
对吗?了解这些事情会很有趣。
谢谢
最佳答案
这些是许多语言(c、c++、java、javascript、.NET 等)中的字符转义序列。它们直接转换为等效的 ASCII 值(您将其发布为 chr(13)
,在一种语言中,它会根据该 ASCII 值生成一个字符)。
它们的含义是:
\n == chr(13) == carriage return
\r == chr(10) == line feed
\t == chr (9) == tab
这些都来自打印机的控制字符,进而来自打字机。
A carriage return brings the typewriter to the beginning of the line.
A line feed brings the typewriter to the next line.
A tab moves the typewriter to the next tab stop.
将打字机带到下一行的开头需要换行和回车的组合。
windows 和 unix 之间的差异源于不同平台对如何表示新行的不同决定。 Unix 使用回车(可能也是为了节省空间),Windows 两者都有。 Mac 过去使用换行符。
关于html - 这些字符之间有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6009038/