質問

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