Carriage return line break

Source: Internet
Author: User

\ R = carriage return = Cr = 13

\ N = line feed = LF = 10

 

In Windows, press ENTER = to move the cursor to the beginning of a line, line feed = to move the cursor to the next line.

In Linux, line feed = move the cursor to the beginning of the next line.

In Mac, press ENTER = to move the cursor to the next line.

 

In Java's bufferedreader, The Readline method considers \ r, \ n, and \ r \ n as the delimiter of a row:

/*** Reads a line of text. A line is considered to be terminated by any one * Of a line feed ('\ n'), a carriage return (' \ R '), or a carriage return * followed immediately by a linefeed. ** @ return a string containing the contents of the line, not including * any line-termination characters, or null if the end of the * stream has been reached ** @ exception ioexception if an I/O error occurs */Public String Readline () throws ioexception {return Readline (false );}

 

Another overload of Readline allows you to specify whether to ignore the LF (carriage return) symbol.

/*** Reads a line of text. A line is considered to be terminated by any one * Of a line feed ('\ n'), a carriage return (' \ R '), or a carriage return * followed immediately by a linefeed. ** @ Param ignorelf if true, the next '\ n' will be skipped ** @ return a string containing the contents of the line, not including * any line-termination characters, or null if the end of the * stream has been reached ** @ see Java. io. linenumberreader # Readline () ** @ exception ioexception if an I/O error occurs */string Readline (Boolean ignorelf) throws ioexception {

 

Different editors have different support for line breaks.

Notepad ++ is supported, which is the same as Java by default.

In vim, the Linux rules are adhered to. The carriage return is displayed as a ^ m, and the line feed is a line break.

 

This is not a pure egg pain ................... Just unify it.

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.