Subject Re: [firebird-support] Re: [ib-support] to change the decimal separator
Author Robert martin
Adam,
> I think he is saying that the application when running on countries that
> uses comma as a decimal separator (instead of point like in USA) the
> numbers are formated with commas by the StrToFloat.
>
> I face it every time :-)
>
> I have a FloatToStrSQL function that lookslike this:
>
> function FloatToStrSQL(D:Extended):String;
>
> var
> wDecimalSeparator:Char;
>
> begin
> wDecimalSeparator := DecimalSeparator;
> DecimalSeparator := '.'
> try
> Result := FloatToStr(D);
> finally
> DecimalSeparator := wDecimalSeparator;
> end;
> end;
>
>
> this way I am always sure I will use a point as a Decimal Separator no
> matter how the current locale are set.
>
> see you !
>
>

Hi

I have never used the code you have here but it looks dangerous to me.
Why not just use the following (if you are going to hard code the
decimal separator).

Result := FormatFloat('##0.00', D);


Rob Martin
Software Engineer

phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com

Wild Software Ltd