Ellen Spertus
09/29/2024, 11:53 PMprintln(results.joinToString(separator = "\n"))
println(results.joinToString(separator = System.lineSeparator())
Daniel Pitts
09/30/2024, 12:02 AMprintln
should handle the conversion of "\n"ephemient
09/30/2024, 6:53 AM\n
as a real newlineephemient
09/30/2024, 6:56 AMephemient
09/30/2024, 6:56 AMfor (result in results) println(result)
anyway. no reason to build a big string in memoryEllen Spertus
09/30/2024, 11:50 PMSystem.lineSeparator()
instead of "\n"
. My program will also be reading in a file.Daniel Pitts
09/30/2024, 11:51 PMephemient
09/30/2024, 11:52 PM\n
Klitos Kyriacou
10/07/2024, 5:03 PMKlitos Kyriacou
10/07/2024, 5:10 PMIt should be fine with just “\n”. The system will translate it for you if needed. Only caveat is if you’re writing the file in binary mode, or sending over a network.On the JVM, there's no such thing as "binary mode". That's a mode that exists in C and C++, whose standard libraries do the conversion from "\n" to "\r\n" when required for streams opened in text mode. On Windows, the console (command line window) treats the "\n" character on its own as the same as "\r\n".
Daniel Pitts
10/07/2024, 5:27 PMKlitos Kyriacou
10/07/2024, 5:48 PMDaniel Pitts
10/07/2024, 5:51 PM