[Gambas-user] Possible bug?: Regional formats, float, text and val() function

Rolf-Werner Eilert eilert-sprachen at ...221...
Tue May 14 08:23:29 CEST 2013



Am 14.05.2013 02:58, schrieb Willy Raets:
> Hello,
>
> I have following problem in a project:
>
> When Regional settings are English US of UK this works fine
> When Regional settings are a European mainland country this results in:
>
> Error 6: Type mismatch: wanted Float, got Null instead
>
> Seems that Val() doesn't take regional settings into account
> When a text contains 5,5 (with a comma) Val() returns Null
> When a text contains 5.5 (with a dot) Val() returns 5.5
>

Hi Willy,

I know it, and I used to think this was standard behaviour. Every number 
notation which is beyond English US results in Null. I am in Germany 
with commas for decimals...

So for a long time I have been replacing 5,5 by 5.5 before calling 
val(), even in other interpreters than Gambas. Are you sure it is really 
defined as to look for the locale?

And with Gambas I always have it checked for Null before daring to let 
val() look into the string. In practice, it would be way easier to have 
val() simply return Zero on all non-valid actions, like it's done in 
other interpreters.

Just my 2 cents about it...

Regards
Rolf




More information about the User mailing list