[Gambas-user] number format

Epíleg epileg at ...626...
Sun Jan 27 10:48:41 CET 2008


En/na Fabien Bodard ha escrit:
> simply do val(textbox.text) but you must take care that your system location
> is correct
> 

I got a wrong behavior with 'val' function (I think).


In an US English locale, I got this:

Val("1,234,567.89")  =>  1234567.89


In a Germany German locale:

Val("1.234.567,89")  =>  1234567.89


But in a France French locale:

Val("1 234 567,89")  =>  1


The thousands separator in all locales cases are correctly set:

$ LANG=en_US.UTF-8 locale -k LC_NUMERIC
decimal_point="."
thousands_sep=","
grouping=3;3
numeric-decimal-point-wc=46
numeric-thousands-sep-wc=44
numeric-codeset="UTF-8"

a$ LANG=de_DE.UTF-8 locale -k LC_NUMERIC
decimal_point=","
thousands_sep="."
grouping=3;3
numeric-decimal-point-wc=44
numeric-thousands-sep-wc=46
numeric-codeset="UTF-8"

$ LANG=fr_FR.UTF-8 locale -k LC_NUMERIC
decimal_point=","
thousands_sep=" "
grouping=3;3
numeric-decimal-point-wc=44
numeric-thousands-sep-wc=32
numeric-codeset="UTF-8"

Thanks,
Epíleg.





More information about the User mailing list