html - 这些字符之间有什么区别?

标签 html windows linux web-applications special-characters

<分区>

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/

相关文章:

javascript - UpdatePanel 内的标签不会显示从代码隐藏分配的值

css - 根据 div 的大小显示元素

c++ - 安装了全局 Hook 后,我如何知道窗口何时开始移动以及何时停止移动?

linux - 使用奇怪的 unicode 名称重命名文件

javascript - 如何防止 "window.location.replace()"被覆盖?

python - 如何让 Windows 知道我用 Python 编写的服务?

python - 在 For 循环中从 Windows 批处理文件中的数组访问项目

xml - 使用 sed 创建 XML 数组

python - 如何制作自己的命令

html - IE/FF/Chrome 之间的文本框宽度不同 - 当文本框填充 'W' s 时导致问题