i need read text file line line till find specific string. i'm using bufferedreader.readline()
when debug find starts third line in file , skips lines after that. here code:
try { reader = new bufferedreader(new filereader(path)); string line1 = null; while ((line1 = reader.readline()) != null) { if (line1.tostring() == invocation0) { found = true; return false; } else if (line1 == invocation1) { found = true; return true; } } } catch (exception e) { e.printstacktrace(); } { if (reader != null) try { reader.close(); } catch (ioexception e) { } }
i appreciate help, tried many different solutions , still can't solve issue.
the content of file like:
.//============================================================================ .// file: abc.mark .// description: .// notice: .// .//============================================================================ .invoke removeclass("properties",0)
if(line1.equals(invocation0))
use equals()
method string
value comparison.
also, instead of return
within if
, can use break
. suggestion though.
Comments
Post a Comment