java - Check if readLine is blank, but don't read a line -


i have while loop performs while readline != "". problem is, reads line , moves on next one, not want. need either test whether line blank without moving on next line, or go before reading it.

thanks in advance.

while (filereader.readline() != "") {      string readline = filereader.readline(); } 

you provided little information, guess problem don't have actual string inside loop body. correct me if i'm wrong.

to address problem, do:

string line; while(((line = reader.readline()) != null) && !("".equals(line)))  {   system.out.println("line: "+line); } 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -