什么是\ rr;为什么会用\ n来使用它? [英] What is a \r" and why would one use it with a \n?

查看:257
本文介绍了什么是\ rr;为什么会用\ n来使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这两个字符串有什么区别?

What is the difference between this two strings?

第一行\ n第二行第一行\\\\ n第二行

推荐答案

\ r - 回车


\ n - 换行

\r - Carriage Return
\n - Line Feed

\\\\ n 通常优先用于 \ n 因为它在unix和Windows上都能正常显示。

\r\n is often used in preference to \n as it displays properly on both unix and Windows.

回车仅将光标返回到同一行的开头(不会前进到下一行)而是一行Feed会输入一个新行。

Carriage Return just returns the cursor to the beginning of the same line (without advancing to the next line) whereas a Line Feed feeds a new line.

注意: (将鼠标悬停在下面的灰色框中查找)


如果您曾经拿过打字机,请尝试使用它。这是一个如此壮观的工程,这些日子里没有多少人可以体验。

If you ever get hold of a typewriter, try using it. It is such a magnificent piece of engineering which not many get to experience these days.

这篇关于什么是\ rr;为什么会用\ n来使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆