Pregunta

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.

¿Fue útil?

Solución

I tried this and it works:

while((charT = reader.read()) != -1) {
if(charT != '\n')
System.out.println("Carriage Return!");
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top