I’m just trying to convert a float I read from Exel to a string with using a comma as decimal separator and two digits behind the comma.
I try the following code
$a = 707.63790474
$l = New-Object System.Globalization.CultureInfo("de-CH")
"CH: " + $a.ToString("F2", $l)
$l = New-Object System.Globalization.CultureInfo("de-DE")
"DE: " + $a.ToString("F2", $l)
$l = New-Object System.Globalization.CultureInfo("en-US")
"US: " + $a.ToString("F2", $l)
and get
CH: 707.64
DE: 707,64
US: 707.64
But to my knowledge a comma is used as decimal separator in Switzerland, unless it is a currency cf. http://en.wikipedia.org/wiki/Decimal_mark. Do I miss something?
Type
(New-Object System.Globalization.CultureInfo("de-CH")).numberFormatto get numberformatinfo for de-CHYou’ll get:
As you can see both NumberDecimalSeparator and CurrencyDecimalSeparator are .