[fpc-pascal] Currency symbol wrong location
Leonardo M. Ramé
martinrame at yahoo.com
Sat Jun 9 18:10:37 CEST 2012
----- Original Message -----
> From: Ludo Brands <ludo.brands at free.fr>
> To: 'FPC-Pascal users discussions' <fpc-pascal at lists.freepascal.org>
> Cc:
> Sent: Saturday, June 9, 2012 12:54 PM
> Subject: RE : [fpc-pascal] Currency symbol wrong location
>
>> This is as per doc?
>>
>> http://www.freepascal.org/docs-html/rtl/sysutils/format.html
>>
>> FloatToStrF(Argument,ffGeneral,Precision,3)
>>
>> M Currency format. the next argument in the var{Args}
>> array must be a
>> floating point value. The argument is converted to a decimal
>> string using currency notation. This means that fixed-point
>> notation is used, but that the currency symbol is appended.
>> If precision is specified, then then it overrides the
>> CurrencyDecimals global variable used in the FloatToStrF
>>
>> In short, the M specifier formats it's argument as follows:
>>
>> FloatToStrF(Argument,ffCurrency,9999,Precision)
>>
>> Note the /append/ :-)
>>
>
> Then there seems to be a contradiction in the doc. The position of the
> currency symbol in FloatToStrF with ffCurrency is determined by
> CurrencyFormat.
>
> CurrencyFormat:=0;
> s:=FloatToStrF(123.25,ffCurrency,5,2);
> s:=Format('%m', [123.25]);
>
> Both calls return $123.25 in s.
>
> Ludo
>
Thanks, that worked. The trick was CurrencyFormat := 0;
Leonardo M. Ramé
http://leonardorame.blogspot.com
More information about the fpc-pascal
mailing list