So I've recently received a large text file that I need to read unfortunately its formatted terribly as there are next line characters everywhere making it extremely difficult to read. So I've been trying to think of a way to sort through the file and delete each nextLine
using a java program.
For example if we had this text:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse rhoncus interdum condimentum. Proin viverra
justo vel imperdiet sagittis, purus sapien sagittis mi, et blandit purus ante non libero. Nulla ac
augue ut odio eleifend interdum
ac id justo. Quisque rutrum euismod sem, vel euismod nunc convallis eu. Praesent odio velit,
condimentum id scelerisque
iaculis, vulputate vitae lacus. Fusce adipiscing blandit libero eu venenatis.
Vestibulum nec urna
pulvinar arcu pretium
pretium. Duis vitae augue dolor. Etiam consectetur feugiat
diam sit amet gravida.
we would like it to turn out like this :
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse rhoncus interdum
condimentum. Proin viverra, justo vel imperdiet sagittis, purus sapien sagittis mi,
blandit purus ante non libero. Nulla ac augue ut odio eleifend interdum ac id justo.
Quisque rutrum euismod sem, vel euismod nunc convallis eu. Praesent odio velit,
condimentum id scelerisque iaculis, vulputate vitae lacus. Fusce adipiscing blandit
libero eu venenatis. Vestibulum nec urna pulvinar arcu pretium pretium. Duis vitae
augue dolor
I'm not very experienced with reading/writing text file using Java. My current idea is reading in each char value checking if it is equal to the value of next line and proceeding to write that char to a separate text file if it is not. But i'm not really sure on how to implement this. I'm not sure how to check if a the next character is a next line.
Any help would be great.