Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.scripting.vbscript > #11111
| From | "Ruediger Roesler" <worm.composter@nospam.arcornews.de> |
|---|---|
| Newsgroups | microsoft.public.scripting.vbscript |
| Subject | Re: SetLocale and automatic conversion |
| Date | 2015-07-11 19:11 +0200 |
| Organization | No Such Agency |
| Message-ID | <d0d14lFdt6gU1@mid.individual.net> (permalink) |
| References | <55a11266$0$2946$e4fe514c@news2.news.xs4all.nl> <d0cqj6Fc8liU1@mid.individual.net> <55a13589$0$2842$e4fe514c@news2.news.xs4all.nl> |
R.Wieser <address@not.available> typed:
>> And a variable of the type double is always written
>> with a decimal point.
>
> I'm not at all sure if I understand you here, as the output of your
> own code already shows otherwise ...
Sorry, it did not.
Ok, it's a little bit confusing, I have expanded the code a little bit:
'############################ Add1.vbs ################################
For Each str In WSH.Arguments
For Each i In Array("de-de", "en-us", "en-gb", "nl-nl", "fr-fr")
SetLocale (i)
WSH.Echo vbCRLF & "Calculate the value of " & str & " plus 1:"
If IsNumeric(str) Then
WSH.Echo i & ": " & CDbl(str) & " + 1 = " & CDbl(str) + 1
WSH.Echo i & ": " & str & " + 1 = " & str + 1
Else
WSH.Echo "Is not a numeric value in " & i & ": " & str
End If
WSH.Echo vbCRLF & "Now computing another value for output:"
WSH.Echo i & ": " & 3.141 & " * 10^3 + 1 = " & 3.141 * 10^3 + 1
WSH.Echo i & ": " & 3,141 & " * 10^3 + 1 = " & 3,141 * 10^3 + 1
Next
Next
'############################ Add1.vbs ################################
You see the different results in French? In the French locale conversion
the correct number of digits is checked, otherwise it results in an
error. In other language conversions it's not. SetLocale refers only to
the output of strings, but also to the conversion of input strings into
the correct VBScript format for a calculation of digits.
The locale conversion routine parses the digits for separation signs and
removes them all, but not in the french version, there they will be only
removed if the number of digits is right (three!). The behaviour of
VBScript seems a little bit astonishing, I have to confess. Maybe I have
understand you wrong because I have not seen your code and what do you
want.
--
ЯR
Back to microsoft.public.scripting.vbscript | Previous | Next — Previous in thread | Next in thread | Find similar
Re: SetLocale and automatic conversion "Ruediger Roesler" <worm.composter@nospam.arcornews.de> - 2015-07-11 17:17 +0200
Re: SetLocale and automatic conversion "R.Wieser" <address@not.available> - 2015-07-11 17:28 +0200
Re: SetLocale and automatic conversion "Ruediger Roesler" <worm.composter@nospam.arcornews.de> - 2015-07-11 19:11 +0200
Re: SetLocale and automatic conversion "R.Wieser" <address@not.available> - 2015-07-11 20:17 +0200
Re: SetLocale and automatic conversion Todd Vargo <tlvargo@sbcglobal.netz> - 2015-07-11 14:26 -0400
csiph-web