Double To String in specific format

Hi everyone, I want to convert a double variable in a string with specific format.

For example:

1238.2
I want that number in the format: 1.238,20 (€)

Is it possible?

ourdouble.tostring

or covert.tostring(Yourdouble)

try this

But I want the format 0.000.000,00

hi @ajgb

image

Hi,

  1. Assign Activity: Start by storing your double value in a variable. Let’s say the variable name is doubleValue and it contains the value 1238.2.
  2. Assign Activity: Convert the doubleValue to the desired format using the ToString method with a specific format string.

formattedString = doubleValue.ToString(“N2”, new CultureInfo(“fr-FR”)) + " (€)"

N2: This specifies that the number should be formatted with a thousands separator and two decimal places.

CultureInfo(“fr-FR”): This uses the French culture settings which format numbers with a comma as the decimal separator and a dot as the thousands separator. This will result in “1.238,20”

1 Like

grafik

You can use your local CultureInfo, but keep in mind: fr-FR has configured Space as Group Seperator:
grafik

thank you! it works!!

1 Like

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