Главная О проекте

Информация о разрывах строк

What is a 'newline'?

    In computing, the carriage return (CR) is one of the control characters in ASCII code, Unicode or EBCDIC that commands a printer or other sort of display to move the position of the cursor to the first position on the same line. It was mostly used along with line feed, a move to the next line, while carriage return precedes line feed to indicate a new line. The term derives from the above usage, as early printers often closely resembled typewriters; this control character would activate a physical carriage-return mechanism.

    On printers, teletypes, and computer terminals that were not capable of displaying graphics, the carriage return was used without moving to the next line to allow characters to be placed on top of existing characters to produce character graphics, underlines, and crossed out text.

    Many computer programs use the carriage return character, alone or with a line feed, to signal the end of a line of text, but other characters are also used for this function (see newline); others use it only for a paragraph break (a hard return). Some standards which introduce their own representations for line and paragraph control (for example HTML) treat carriage return and line feed as whitespace.

    In ASCII and Unicode, the character code decimal 13 (or hexadecimal 0D) is defined to be carriage return, it may also be seen as control+M or ^M. In the C programming language, and many other languages influenced by it, \r denotes this character.

    Source: Wikipedia

What is a carriage return?

    In computing, a newline, also known as a line break or end-of-line (EOL) character, is a special character or sequence of characters signifying the end of a line of text. The name comes from the fact that the next character after the newline will appear on a new line - that is, on the next line below the text immediately preceding the newline. The actual codes representing a newline vary across operating systems, which can be a problem when exchanging data between systems with different representations.

    There is also some confusion whether newlines terminate or separate lines. If a newline is considered a separator, there will be no newline after the last line of a file. The general convention on most systems is to add a newline even after the last line, i.e. to treat newline as a line terminator. Some programs have problems processing the last line of a file if it is not newline terminated. Conversely, programs that expect newline to be used as a separator will interpret a final newline as starting a new (empty) line.

    In text intended primarily to be read by humans using software which implements the word wrap feature, a newline character typically only needs to be stored if a line break is required independent of whether the next word would fit on the same line, such as between paragraphs and in vertical lists.

    Source: Wikipedia