how to convert string to double?

  • Thread starter Thread starter cindy liu
  • Start date Start date
You shoud use

Double.Parse( doubleString ) if you are sure current thread Culture is the
same as doubleString number represented in (decimal point char is important)
or
Double.Parse( doubleString, specificCulture ) if you have to convert from a
specific culture (see System.Globalisation)
or
Convert.ToDouble( doubleString ) to perform neutral culture conversion (so
decimal point should be "." )

so if you writes doubleString as
double d = 1.21
string doubleString = d.ToString()
or use WriteLine etc to write doubles you should use same culture to parse
values that was used when doubles were written to string.
 
Back
Top