[fpc-pascal] Currency symbol wrong location
    Ludo Brands 
    ludo.brands at free.fr
       
    Sat Jun  9 17:54:41 CEST 2012
    
    
  
> 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
    
    
More information about the fpc-pascal
mailing list