vendredi 26 février 2021

Transform IF statement into IF NOT statement (Java)

How to transform this IF statement to IF NOT statement?

The purpose of the code is to ignore lines starting with "//" and empty lines.

if (lineOfText.contains("//") || lineOfText.trim().length() == 0)
continue; 

FILE TO BE READ


// this is a comment, any lines that start with //
// (and blank lines) should be ignored


// data is title, itemCode, cost, timesBorrowed, onLoan
item 1, LM002411,3989,781,true
item 2, LM002711,599,0,FALSE
item 3, LM002876,4599,45,TRUE
item 4, LM002468,6395,0,TRUE
item 5, LM002153,4554,0,FALSE

Aucun commentaire:

Enregistrer un commentaire