Subject Re: [firebird-support] Re: [ib-support] to change the decimal separator
Author Alexandre Benson Smith
Robert martin wrote:
> 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
>

Why dangerous ?

Because if i dont specify that the DecimalSeparator should be "." Delphi
uses the Windows Locale Seetings, that in Brazil is defined to use Comma
as Decimal Separator, so the result of

FormatFloat('##0.00', 123.45)

will be 123,45 that is the exactly problem that started this thread.

Off course parameters are preferred.

but in the function e wrote (without exception handling and just as an example)
the result will be
123.45 no matter how DecimalSeparator as set on Windows Locale Settings.

see you !


--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br