I need to convert a string to float. This is my sample line:
1 MW +00000.00 mm
2 MW +0000.000 mm
3 MW -00000.01 mm
4 MW +00000.00 mm
5 MW +00002.92 mm
6 MW +00002.69 mm
And here is what I do:
text = text.Substring(pos + 5, 9).Trim(); float val = 0.0F; float.TryParse(texto, out val); this.txtDimension1.Text = val.ToString();
Ok, this works for my environment, which is en_US, but when I run the same piece of code in the Spanish environment, it converts -00000.01 to -1.0
I think this is a comma problem, in English the numbers are separated by a period (".") And Spanish, they are separated by a comma (",").
How can I do this job in both languages?
Thanks Richard.
source share