\n 和 \r\n 有什么区别? [英] What's the difference between \n and \r\n?

查看:56
本文介绍了\n 和 \r\n 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它们都表示换行",但什么时候用一个代替另一个?

They both mean "new line" but when is one used over the other?

推荐答案

\r\n is a Windows Style

\r\n is a Windows Style

\n 是一种 POSIX 样式

\r 是旧的 OS X 之前的 Mac 风格,现代 Mac 使用 POSIX 风格.

\r is a old pre-OS X Macs Style, Modern Mac's using POSIX Style.

\r 是回车符,\n 是换行符,旧电脑没有显示器,只有打印机将程序结果输出给用户,如果你想从左边的新行开始打印,你必须为 Line Feed 获取 \n\r for get Carriage return to the most left position, this is from old computer syntax to this time in Windows platform.

\r is a carriage return and \n is a line feed, in old computers where it not have monitor, have only printer to get out programs result to user, if you want get printing from staring of new line from left, you must get \n for Line Feed, and \r for get Carriage return to the most left position, this is from old computers syntax saved to this time on Windows platform.

这篇关于\n 和 \r\n 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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