Question - How can we split Java String by newlines?
Answer -
There are many ways for entering a new line character:
\r represents CR (Carriage Return), which is used in Unix
\n means LF (Line Feed), used in Mac OS
\r\n means CR + LF, used in Windows
The most forward way for splitting strings by new line is :
String lines[] = String.split("\\r?\\n");