11
There are two different ways to break a CR line (Carriage Return) and LF (line feed).
What is the difference between these two? When should one or the other be used? Depends on the system? Language?
11
There are two different ways to break a CR line (Carriage Return) and LF (line feed).
What is the difference between these two? When should one or the other be used? Depends on the system? Language?
15
As the name says the CR makes back to the beginning of the line and the LF is to go to the next line. Roughly it is the end of the line. This comes from the fact that printers worked like this.
In theory they should work independently and to go to the beginning of the next line should use both. But some systems have agreed to interpret only one of them as the intention to do both actions, even for space-saving purposes.
As with much in computing, it depends on who is interpreting. It is common to choose CR (Mac Os) or LF (Linux) or CR+LF (Windows) depending on the operating system because many of its tools have been made to interpret only one of these ways. But each tool can give you the semantics you want for this.
This is not to say that an operating system works with a terminator, only the tools available on it prefer or only accept a specific terminator. The best tools try to adapt.
In the background they are characters 13 and 10 of the ASCII table, so in various scenarios this does not mean anything with treatment of lines of text. Where there is a semantics in this sense, it has to see the documentation.
You can create a format that they are interpreted as you want. You can even use them to finish a line. It will only escape the pattern.
It depends on all this and is common when you will exchange text data between operating systems or even between specific tools.
Most languages have a way of abstracting the end-of-line indicator and it - via compiler or Runtime - is responsible for using the correct characters in each operating system.
0
For the purpose they were defined, in the primordial computer sciences, they represent literally printing commands. How everything was seen as an impression(including the output to the monitor) it was necessary to pass specific commands (used until today in many cases) format that would not be printed (visible to the user) but interpreted by the hardware (printer, monitor, etc.).
Browser other questions tagged string language-independent line-breaks
You are not signed in. Login or sign up in order to post.