I have a text file,which I use to input information into my application.The problem is that some values are float and sometimes they are null,which is why I get an exception.
var s = "0.0";
var f = float.Parse(s);
The code above throws an exception at line 2 “Input string was not in a correct format.”
I believe the solution would be the advanced overloads of float.Parse,which include IFormatProvider as a parameter,but I don’t know anything about it yet.
How do I parse “0.0”?
Dot symbol “.” is not used as separator (this depends on Culture settings). So if you want to be absolutely sure that dot is parsed correctly you need to write something like this: