I encountered the following issue when trying read numbers from a csv file. The numbers are well formed and decimal points are also correct (dots):
10;111.1;0.94
9.5;111.1;0.94
9;111.4;0.94
8.5;110.7;0.94
I read the file line by line and split each of them into three tokens, free of white spaces etc. (e.g. "10","111.1","0.94"). In spite of this I got the exception when calling a parsing function:
Double pwr = Double.parseDouble(tokens[1]);
Double control = Double.parseDouble(tokens[0]);
Double cos = Double.parseDouble(tokens[2]);
java.lang.NumberFormatException: For input string: "10"
When I change the order of lines, e.g., 1 <--> 2, the problem persists, but now I got java.lang.NumberFormatException: For input string: "9.5"
What is interesting, every time I make the above calls from the debugger level, I obtain correct values with no exception. It looks like a problem related to the first line of file.
Have you any idea where the problem source is?