[Lazarus] JSON float saving scientific value
tcoq
tcoq at free.fr
Wed Nov 9 17:54:03 CET 2011
Indeed, the localization is an issue, but it is possible to force FloatToStr to output a decimal '.' in all cases, whatever the localization. Isn't it
DecimalSeparator? Change DecimalSeparator to '.'.
Something like this (untested/uncompiled pseudo-code):
Function FloatToStrMine( aNumber: Double): String;
var
oldDecimal: Char;
begin
oldDecimal := DecimalSeparator;
DecimalSeparator := '.';
try
result := FloatToStr( aNumber)
finally
DecimalSeparator := oldDecimal;
end;
end;
Best regards,
Thierry
----- Mail Original -----
De: "Michael Van Canneyt" <michael at freepascal.org>
À: "Lazarus mailing list" <lazarus at lists.lazarus.freepascal.org>
Envoyé: Dimanche 6 Novembre 2011 16h22:09 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
Objet: Re: [Lazarus] JSON float saving scientific value
...
You should definitely not do that, because then the resulting string is localized.
JSON is not localized. It MUST use a . as the decimal separator.
More information about the Lazarus
mailing list