on a german pc:
PS C:\Temp> [double]::Parse("12.3")
123
PS C:\Temp> [double]"12.3"
12,3
extremely unpleasant to debug such errors ...
Harald
on a german pc:
PS C:\Temp> [double]::Parse("12.3")
123
PS C:\Temp> [double]"12.3"
12,3
extremely unpleasant to debug such errors ...
Harald
PS> $nfi = new-object System.Globalization.NumberFormatInfo
PS> $nfi.NumberDecimalSeparator = ','
PS> [double]::Parse('3,1415', $nfi)
3,1415
--
greetings (from Germany)
dreeschkind
"Harald Ums (2179630)" wrote:
> on a german pc:
> PS C:\Temp> [double]::Parse("12.3")
> 123
> PS C:\Temp> [double]"12.3"
> 12,3
>
> extremely unpleasant to debug such errors ...
>
> Harald
>
This should also work:
PS> $bratwurst = new-object System.Globalization.CultureInfo "de-DE"
PS> [double]::Parse('0,815', $bratwurst)
0,815
--
greetings
dreeschkind
"dreeschkind" wrote:
> PS> $nfi = new-object System.Globalization.NumberFormatInfo
> PS> $nfi.NumberDecimalSeparator = ','
> PS> [double]::Parse('3,1415', $nfi)
> 3,1415
>
> --
> greetings (from Germany)
> dreeschkind
>
> "Harald Ums (2179630)" wrote:
>
> > on a german pc:
> > PS C:\Temp> [double]::Parse("12.3")
> > 123
> > PS C:\Temp> [double]"12.3"
> > 12,3
> >
> > extremely unpleasant to debug such errors ...
> >
> > Harald
> >
Hi dreeschkind,
or if one prefers one-liners:
PS> [Double]::Parse('0,815', [Globalization.CultureInfo]'de-DE')
0,815
cu
Max
I hoped there is something like LC_LOCALE=C and everything would be handled
in the invariant locale.
It is not the problem to change one or two statements, but to get a reliable
environment, that gives the same results independend of who runs the skript.
"Maximilian Hänel" <ngSpam@smjh.de> wrote in message
news:%23zhDLcFtHHA.4796@TK2MSFTNGP04.phx.gbl...
> Hi dreeschkind,
>
> or if one prefers one-liners:
>
> PS> [Double]::Parse('0,815', [Globalization.CultureInfo]'de-DE')
> 0,815
>
> cu
>
> Max
| Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| dotnet DLL im IE | Tobias Bergmann | .NET General | 0 | 20 Oct 2009 |
| Beginner - which is best dotnet.VB or dotnet.VC? | SteveB | .NET General | 6 | 07 Sep 2008 |
| Dotnet 2.0 | RG | .NET General | 4 | 16 May 2008 |
| Powershell and different dotnet versions | Whisperer | PowerShell | 4 | 15 Sep 2007 |
| Powershell and sync data | Cyber-Guy | PowerShell | 11 | 05 Sep 2007 |