Line-break identification for different systems
< Span style= "Background-color:inherit" >windows |
|
linux/unix |
\ n |
mac OS |
|
Method in Commons-io Package: fileutils.writestringtofile (File, "The first row is \\n\n the second row is \\r\r the third row is \\n\\r\n\r line fourth is \\r\\n\r\n fifth row"); Write this section to a file in Windows Notepad and the Eclipse project directory, respectivelyThis is my test data: The first line is \\n\n the second row is \\r\r the third row is \\n\\r\n\r line fourth is \\r\\n\r\n fifth rowFile write results in eclipse:
The first line is \ n the second line is \ r The third line is \n\r line fourth is \ r \ n Fifth line |
Windows Notepad writes the results:
The first line is \ n the second line is \ r The third line is \n\r line fourth is \ r \ n Fifth line |
Then you can see that in\ r \ nis a line-wrapping operation under Windows, and \n,\r in Eclipse,\ r \ nCan implement line breaks, and \n\r can implement two lines in eclipse. To ensure that line breaks are possible in both Eclipse and windows, it is recommended to use\ r \ n (because I use Windows)。
Thus, it can be seen that eclipse is actually the support for line-of-exchange identities in different systems, so any one of the identities in eclipse can be wrapped, but specifically selected in a specific system.
Eclipse and line breaks in Windows