My program is reading a text file and doing actions based on the text. But the first line of the text is problematic. Apparently it starts with "". This is messing my startsWith()
checks.
To understand the problem I've used this code :
System.out.println(thisLine
+ " -- First char : (" + thisLine.charAt(0)
+ ") - starts with ! : "
+ thisLine.startsWith("!"));
String thisLine
is the first line in the text file.
it writes this to the console :
! use ! to add comments. Lines starting with ! are not read. -- First char : () - starts with ! : false
Why is this happening and how do I fix this? I want it to realize that the line starts with "!" not ""