Frage

I have a string that looks something like this:

"foobar\n"

I read this string using a BufferedReader. I need to be able to detect whether or not there is a new line present. I was using readLine, but I switched to read so I could grab the \n but no luck.

War es hilfreich?

Lösung

I tried this and it works:

while((charT = reader.read()) != -1) {
if(charT != '\n')
System.out.println("Carriage Return!");
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top