The difference between \r,\n,\r\n

Source: Internet
Author: User
Tags html interpreter word wrap

\ n is a newline, English is new line, which means to make the cursor to the beginning
\ r is the carriage return, English is carriage return, which means to move the cursor down one cell

\ r \ n indicates carriage return line

We usually use the computer, has been accustomed to the carriage return and a change of line once, hit a return, that is, the carriage returns, but also a newline.

1, \ n Soft return :


Represents a newline in windows and returns to the beginning of the next line. Equivalent to the \ r effect in Mac OS.
In Linux, Unix only represents line breaks, but does not go back to the beginning of the next line.

2, \ r Soft Space:


In Linux, Unix represents the return to the beginning of the line.
Represents a newline in Mac OS and returns to the beginning of the next line, equivalent to the effect of \ n in Windows.


3, \ t jumps (moves to the next column).


They are valid in a double-quote or delimiter-represented string, and are not valid in a single-quote string.
\ r \ n generally used together, to indicate the key on the keyboard return, you can only use \ n.
\ t represents the "tab" key on the keyboard.

Just like you use the difference between enter and Shift+enter

4. NewLine symbols in the file:



Linux,unix: \ r \ n
Windows: \ n
Mac OS: \ r



5, the meaning of commonly used escape symbols:

\ 0x0a (10) in LF or ASCII
\ r 0x0d (13) in CR or ASCII
\ t Horizontal tab-HT or ASCII in 0x09 (9)
\ \ counter Slash
\$ dollar Symbol
\ "Double quotation marks
\ ' Single quotation mark

6. The difference between "\ r \ n" and "</br>"

\ r \ n is the output HTML code wrapping, the customer sees the effect does not wrap.

If you are exporting to a browser, use <br/>

\ r \ n, like you make a Web page in Dreamweaver, click Enter in the source code, is to feed the source code return line.
is to output one (HTML markup language) that is interpreted as the input word wrap in HTML. \ r \ n The role is to give the source code carriage return line, input, look at the HTML source code, it will be to have a newline, and the HTML interpreter (browser) think it is useless, with not all the same display.


The difference between \r,\n,\r\n

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.