I want to parse a numeric file. I achieve parsing but when I changed the file content, I get a StringIndexOutOfBoundsException. Any help will be appreciated.
My code is
The only thing here, which can throw an IndexOutOfBoundsException
is the
s.charAt(0)
code.
That means that in this line on the first position there is nothing = empty line.
Try the following in the beginning of your loop:
if(s == null || s.trim().length() == 0)
{
System.out.println("Empty line found.");
continue;
}