[Lazarus] whats wrong with that line of code?

Werner Pamler werner.pamler at freenet.de
Sat Aug 15 12:24:07 CEST 2015


As Michael said "%M" is not a format specifier for the FormatCurr 
function, use "0.00" to get two decimal places . Moreover, as I see in 
my tests, the currency symbol is not added (because "FormatCurr()" 
internally calls "FormatFloat()"). I must confess that the docs are 
quite confusing here...

This should work
   Label2.Caption := FormatCurr('0.00 €', 111111111.0);


Am 15.08.2015 um 12:11 schrieb John Landmesser:
> Hi Michael,
>
> sorry, i still don't get it:
>
> Help to FormatFloat tells me:
> "FormatFloat formats the floating-point value given by Value using the 
> format specifications in Format."
>
> .. and help to Format:
> "M Currency Format ..."
>
> So please correct my,
> FormatCurr('%M',111111111)
> so i am able to understand my mistakes ...
>
> thank you!
>
> Ok, i'm stupid!!!
>
>
>
>
> On 15.08.2015 11:40, Michael Van Canneyt wrote:
>>
>>
>> On Sat, 15 Aug 2015, John Landmesser wrote:
>>
>>> CurrencyString shows €
>>>
>>> FormatCurr('%M',111111111) -> %M
>>>
>>> Expected a currency string as '111.111.111,00 €'
>>>
>>> System: Linux, Debian Sid
>>>
>>> sorry for that really idiotic question :-))
>>
>> Why do you think %M is a formatting character ?
>>
>> Valid formatting characters are described at:
>>
>> http://www.freepascal.org/docs-html/rtl/sysutils/formatfloat.html
>>
>> Michael.
>>
>>
>> --
>> _______________________________________________
>> Lazarus mailing list
>> Lazarus at lists.lazarus.freepascal.org
>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150815/ea7ceb90/attachment-0003.html>


More information about the Lazarus mailing list