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?

有帮助吗?

解决方案

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)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top