Localized number formats problem/question

Hi All, working in RhinoScript here, I have some settings saved in ini file as strings, in a US decimals format, let’s say a=“0.89”.
When I want to use it as a number, I do Cdbl(a) to convert.
But when I do the same with a Rhino version that uses comma in decimals, Cdbl returns error.
For example in Polish version of Rhino, running Cdbl(“0.89”) results in error, it has to be "Cdbl(“0,89”).

How to best handle such cases of number conversion that depend on language version?
Is there anything built-in VBScript to handle these cases automatically?
(maybe I should write a function that looks for “.” and replaces it with “,”, and vice-versa?)



Does this help?

– Dale

1 Like

Hi Dale, yes - that’s exactly what I was looking for. Thank you!
To solve my problem above, with vbscript conversion results being localized inside the script (like decimals delimiters or even translated boolean value names), the solution to operate only in the desired format and making sure the code works on all Rhino version could be:

    ' remember current localeID
    Dim intGetLocaleID = GetLocale()

    'set your script locale to the desired format
    Call SetLocale(1033)

    ' /// DO SOMETHING ///

    'reset locale
    Call SetLocale(intGetLocaleID)

hi @dale,

Is similar locale setting needed/available in Python scripts running in Rhino in order to interpret and read/write values like Double number formats and boolean value names?

I don’t believe so.

– Dale