Format a number with . and ,

My robot recives the string “1021,940000” but it has to be in the correct number format, in this case something like “1.021,94”

To limit decimal into 2 i’m using Double.Parse(value).ToString("##.00") but i don’t know how to set the comma to decimal cases and dot to separate the rest

If your current CultureInfo is already correct:
Double.Parse(value).ToString("N2")

Otherwise, specify the CultureInfo:
Double.Parse(value, New System.Globalization.CultureInfo("es-ES")).ToString("N2", New System.Globalization.CultureInfo("es-ES"))

image

1 Like

Thank you!

I’m using this: Double.Parse(value).ToString(“N2”).Replace(",",";").Replace(".",",").Replace(";",".")

Because if i use just Double.Parse(value).ToString(“N2”) or CultureInfo it will print 1,021.94

I don’t know if the way i’m using is correct, but it’s working

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.