Question

When I use formatting for numbers bigger than 1000 like this :

"{0:F2}" -f 1000

I get this 1000.00 result for a US system language

and I get this 1000,00 result for a DE (german) system language.

Now I want to avoid that , without using replace ",","." or something.

So how to get a culture independent formatting?

Was it helpful?

Solution

You could use ToString along with CultureInfo set to en-US, e.g.:

$a = New-Object System.Globalization.CultureInfo("en-US")
$b = 1000
$b.ToString("0.00", $a)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top