What is the difference between '/n' and '/r/n'? /n /r/n的区别是什么

来源:互联网 发布:dnf一键基址源码 编辑:程序博客网 时间:2024/04/27 13:23

原帖来自http://www.codeguru.com/forum/showthread.php?t=253826

 

背景

There are a few characters which can indicate a new line. The usual ones are these two:

这里有几种表示新行开始的符号

  • '/n' or '0x0A' (10 in decimal) -> This character is called "Line Feed" (LF).
  • '/r' or '0x0D' (13 in decimal) -> This one is called "Carriage return" (CR).

不同的操作系统处理的新行字符是不一样

 

  • 在Dos和Windows下

    新行是按照 /r/n 这样的顺序组合起来的
  • 在Unix和Linux 下

    使用'/n'来作为新行的起始
  • 在Mac平台下

    Macs 用单个的'/r'来作为新行的起始
原创粉丝点击