- \n for Unix
- \r\n for Windows and
- \r for old Macs
- and so on
Always use
System.getProperty("line.separator")
OR
Java 7's way:
System.lineSeparator()
This will let you find out OS specific line separator instead of judging yourself and hard coding it. It also helps you in avoiding bugs.
Bonus information:
The new line characters originated from the old type writer era.
- Carriage return - CR = \r
- Line feed - LF = \n
No comments :
Post a Comment
Your Comment and Question will help to make this blog better...