String[] lines = ascii.getText().split("\\n");
for(int i = 0; i < lines.length; i++){
System.out.println(lines[i]);
if(lines[i] == "")
System.out.println("abc");
}
ascii
is a JTextArea. This is a sample code I'm just testing it before I put it in my program. Right now it splits the lines from ascii into separate strings, and then displays them.
It does that correctly and includes the empty lines which I want. Now I want to check if line is empty (it can contain only spaces). I've tried with combinations of
if(lines[i] == "", " ", "\n"...)
but none of those worked. Can anyone explain how to do it?