How to convert number

after scraping, I collect from a datatable, one string containing a number.
I need to format this Variable, from “3.500” to “3,500.00”

to image 3,500.00

So the thousands separator becomes “,”
and that of decimals “.”

I would like to get a new .tostring variable to be used later.


1 Like

If MyDbl is a Double type variable or an Int32 type variable, assign your string to MyDbl.ToString("N").

1 Like

Hi Anthony.
I’m having trouble with double parse.
Can you help me?
At the moment, after scraping i have , I take the data with these two strings:

Coupa.Rows(0).Item(2).ToString + " - "+ DTSnow3.Rows(0).Item(2).ToString

in writeline: “559,260.00 - 559.260”

Since I have to compare these two values later, I need them to have the same formatting.
They are price, so they must contain thousands, and cents.

Can help me??

1 Like

Try replacing DTSnow3.Rows(0).Item(2).ToString with DTSnow3.Rows(0).Item(2).ToString.Replace(".", ",") + ".00".

in this way, I think it adds the zeroes of the cents, even when the cents are different from 0.
for ex:

559,260.62 - 559.260,62.00

Ah, then try this instead:

DTSnow3.Rows(0).Item(2).ToString.Replace(".", "~").Replace(",", ".").Replace("~", ",").

I don’t know this command.
What exactly does it do?

Replaces “.” with a temporary character “~”, then replaces “,” with “.”, then finally replaces the temporary character “~” with “.”.

Not work…
:frowning: :flushed: :sob: :sob: :sob:
that’s a big problem for me now…