I'm writing a java program that will require a long String as input from the user. Most of these Strings are news articles copied and pasted off the internet. The problem I've having is that when the user enters the text, it contains carriage returns that Scanner has trouble processing. I'm using the nextLine() method from the Scanner class and the problem is that the carriage returns mark the end of lines and thus terminate that read from the Scanner. I've tried the following code, too, but that results in an infinite loop. UserInput2 is a Scanner.
while(userInput2.hasNextLine())
toBeProcessed = toBeProcessed + userInput2.nextLine();
Anyone know how I can skip over the carriage returns? Maybe have the scanner convert them to a '+' or something like that so I don't have this problem.