How can i get a double from string with starting 0,

I get the string “0,70” but when I convert it to double, it written like 70. But I want to use it as 0,70. How can I convert it ?

Numeric values (int, double, etc) don’t retain leading zeroes.

1 Like

Hi @Hulya_Cetinkaya ,

You can use below code to get desired format but as mentioned @postwick decimal values don’t retain leading zeros.


the comma lets interpretate the Conversion function in default mode that it is a GroupSeperator and is not recognizing the comma as decimal seperator.

we can do it eg like

First line is parsing 0,70 by applying local numberformats into a double correctly
We do see it as 0.70 is the internal representation of this number
Kindly note: the internal format of Double we do not touch. In case of we do need another format representation we do it by toString (line2)

So just adopt the locals to your country: e.g. tr-TR for Turkey

tryed: Double.Parse(" 1.400,66".Trim, System.Globalization.CultureInfo.CreateSpecificCulture(“en-EN”)).ToString

but it gives an error: string format is incorrect !!!

Yes, as EN is not specifiying comma as decimal seperator. Use the right culture e.g. as given in the link