New line
The concepts of line feed (LF) and carriage return (CR) are closely associated, and can be either considered separately or together.
https://en.wikipedia.org/wiki/Newline
What is the difference between \r and \n?
They're different characters. \r
is carriage return, and \n
is line feed.
On "old" printers, \r
sent the print head back to the start of the line, and \n
advanced the paper by one line. Both were therefore necessary to start printing on the next line.
Obviously that's somewhat irrelevant now, although depending on the console you may still be able to use \r
to move to the start of the line and overwrite the existing text.
More importantly, Unix tends to use \n
as a line separator; Windows tends to use \r\n
as a line separator and Macs (up to OS 9) used to use \r
as the line separator. (Mac OS X is Unix-y, so uses\n
instead; there may be some compatibility situations where \r
is used instead though.)
For more information, see the Wikipedia newline article.
EDIT: This is language-sensitive. In C# and Java, for example, \n
always means Unicode U+000A, which is defined as line feed. In C and C++ the water is somewhat muddier, as the meaning is platform-specific. See comments for details.
New line的更多相关文章
- ILJMALL project过程中遇到Fragment嵌套问题:IllegalArgumentException: Binary XML file line #23: Duplicate id
出现场景:当点击"分类"再返回"首页"时,发生error退出 BUG描述:Caused by: java.lang.IllegalArgumentExcep ...
- Error on line -1 of document : Premature end of file. Nested exception: Premature end of file.
启动tomcat, 出现, ( 之前都是好好的... ) [lk ] ERROR [08-12 15:10:02] [main] org.springframework.web.context.Con ...
- 关于xml加载提示: Error on line 1 of document : 前言中不允许有内容
我是在java中做的相关测试, 首先粘贴下报错: 读取xml配置文件:xmls\property.xml org.dom4j.DocumentException: Error on line 1 of ...
- Eclipse "Unable to install breakpoint due to missing line number attributes..."
Eclipse 无法找到 该 断点,原因是编译时,字节码改变了,导致eclipse无法读取对应的行了 1.ANT编译的class Eclipse不认,因为eclipse也会编译class.怎么让它们统 ...
- Linix登录报"/etc/profile: line 11: syntax error near unexpected token `$'{\r''"
同事反馈他在一测试服务器(CentOS Linux release 7.2.1511)上修改了/etc/profile文件后,使用source命令不能生效,让我帮忙看看,结果使用SecureCRT一登 ...
- [LeetCode] Line Reflection 直线对称
Given n points on a 2D plane, find if there is such a line parallel to y-axis that reflect the given ...
- [LeetCode] Tenth Line 第十行
How would you print just the 10th line of a file? For example, assume that file.txt has the followin ...
- [LeetCode] Max Points on a Line 共线点个数
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. ...
- "Installation failed !" in GUI but not in CLI (/usr/bin/winusb: line 78: 18265 Terminated )
"Installation failed !" in GUI but not in CLI (/usr/bin/winusb: line 78: 18265 Terminated ...
- How to build .apk file from command line(转)
How to build .apk file from command line Created on Wednesday, 29 June 2011 14:32 If you don’t want ...
随机推荐
- [参考]wget下载整站
wget -m -e robots=off -U "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.6) Gecko/200 ...
- iOS--创建炫酷的渐变色界面
{ CAGradientLayer *_layer; } //创建渐变层 _layer =[CAGradientLayer layer]; _layer.frame=self.view.frame; ...
- Windows远程连接CentOS桌面
VNC (Virtual Network Console)是虚拟网络控制台的缩写.它 是一款优秀的远程控制工具软件.VNC的基本运行原理和一些Windows下的远程控制软件很相像 VNC基本上是由两部 ...
- iSight集成Adams/View:Simcode
虽然iSight有Adams/View接口,但对Adams的版本有限制.下面使用iSight的simcode,就可以支持任意版本的Adams了. Adams模型如下: 1. 编写cmd文件 file ...
- Linux安装软件总结(二.几种安装命令介绍)
一.rpm包安装方式步骤: 1.找到相应的软件包,比如soft.version.rpm,下载到本机某个目录: 2.打开一个终端,su -成root用户: 3.cd soft.version.rpm所在 ...
- dedecms中调用制定栏目
{dede:type typeid='5'} <li> <a href="[field:typelink/]" target="_blank" ...
- freecodecamp记录
来源:https://www.freecodecamp.cn 如果需要填充文本来检查排版效果,网上有自动生成器,乱文生成器:此外Microoft Word中有一个函数能够自动生成每段20句的6段填充文 ...
- TranslateAnimation参数
看TranslateAnimation动画参数,一直忘记四个参数意思: public TranslateAnimation(float fromXDelta, float toXDelta, f ...
- Daily Scrum02 12.08
编译大作业的第一次检查终于过去了,已经经过这次检查的组员们可以暂时松一口气了. 也希望编译大作业有着落的成员可以多花一些时间在团队任务上,帮其他的组员多分担一些工作. 第一次没来的及检查的同学,或是没 ...
- 用 Python 排序数据的多种方法
用 Python 排序数据的多种方法 目录 [Python HOWTOs系列]排序 Python 列表有内置就地排序的方法 list.sort(),此外还有一个内置的 sorted() 函数将一个可迭 ...