Source language: Translate to:

A problem with decimals in different languages

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

A problem with decimals in different languages

Postby calamar » Mon Mar 14, 2011 1:36 pm

Hi all:

I'm creating an application in neobook that makes some math operations with float numbers. The thing is that this software will run both in Spanish and English version of Windows 7. Problem is that in Spanish, decimals are separated with the comma "," and in english it's separated with a dot "."

So I define a variable like "25,4" and in the spanish version of Windows, it works fine. But in the english version, this number is interpreted as "25,400" and math operations are wrong.

The same if I use "25.4". It works well on english version, but in spanish, it's interpreted like "25.400".

I also used the "DefineVar" command but the result is the same.

How can I define a float number without worrying about the language of my Windows system?

Thanks! :wink:
User avatar
Posts: 9
Joined: Mon Jan 05, 2009 4:52 am

Postby Gaev » Mon Mar 14, 2011 3:15 pm


Here are two SubRoutines that will turn ...

- something like 123,456.789 to 123.456,789 ... EnglishToSpanish


- something like 123.456,789 to 123,456.789 ... SpanishToEnglish
Code: Select all
StrReplace "[FromText]" "!." "!$$" "[TempText]" ""
StrReplace "[TempText]" "!," "!." "[TempText]" ""
StrReplace "[TempText]" "!$$" "!," "[ToText]" ""

StrReplace "[FromText]" "!," "!$$" "[TempText]" ""
StrReplace "[TempText]" "!." "!," "[TempText]" ""
StrReplace "[TempText]" "!$$" "!." "[ToText]" ""

Now, all you need to know is ...

- what version of the OS the program is being run on

- whether you need to convert numbers (GoSub) or not (SetVar "[ToText]" "[FromText]")
User avatar
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby HPW » Mon Mar 14, 2011 3:28 pm

You may have a look at neobooks variable [DecimalSymbol].
Since it is a Read-Write Variable, you can read the current setting,
and you can also set it in yor app.
User avatar
Posts: 2510
Joined: Fri Apr 01, 2005 11:24 pm
Location: Germany

Postby calamar » Tue Mar 15, 2011 11:32 am

Thanks both of you for your answers.

I tried HPW solution and it worked. :)

Thanks a lot for your help. :wink:
User avatar
Posts: 9
Joined: Mon Jan 05, 2009 4:52 am

Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest