This may be a simple question, but I was unable to find anything resembling the topic:
I have a program that needs to be run in Linux, and Windows. As you know, Windows new line character is \r\n
, and in Linux/Unix it is \n
(Mac is \r
).
When I need to print anything to a file or to the command line, I can use println() function to create a new line. This works fine, but I need to return many new line characters as Strings so that I can for example use them more than once, modify them, etc. (I can also use find-replace to replace all my \r\n
at the same time.)
The windows character \r\n
I am using currently prints ^M
in Linux.
Is there a character, or method I can use to return new lines in Strings?