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 :-))

Mailing lists / lazarus / 2015-08
12 messages · 5 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
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.
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!!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150815/13258a10/attachment.html>
CurrencyString shows ? FormatCurr('%M',111111111) -> %M Expected a currency string as…
This is how it works with the %m format
procedure TForm1.FormCreate(Sender: TObject);
begin
DefaultFormatSettings.Currencystring := '?';
Label1.Caption := Format('%m', [11111111.0]);
// "Format" instead of "FormatCurr", parameter in square brackets,
value must be a float
end;sorry, i still don't get it: Help to FormatFloat tells me: "FormatFloat formats the…
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);-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150815/ea7ceb90/attachment.html>
Werner Pamler wroteI must confess that the docs are quite confusing here...
To add to that, CurrencyFormat() shows in the docs as "deprecated", but it doesn't suggest a function that replaces it.
http://www.freepascal.org/docs-html/rtl/sysutils/currencyformat.html
Regards,
- Graeme -
sorry, i still don't get it: Help to FormatFloat tells me: "FormatFloat formats the…
"FormatCurr formats the currency Value according to the formatting rule in Format, and returns the resulting string."
here <Format> refers to the parameter format, not the function, as you seemed to surmise.
Yet the next sentence in Help
"For an explanation of the formatting characters, see FormatFloat. "
Should have given you a clue.
Well, I have adapted the text so it is less ambiguous.
Werner has given you a example of what to code.
Michael.
As Michael said "%M" is not a format specifier for the FormatCurr function, use "0.00" to…
Werner Pamler wroteI must confess that the docs are quite confusing here...
And here is a LateX issue in the docs for Format()
Under the "M" currency format text it shows:
Currency format. the next argument in the var{Args} array
The LaTeX "var{...}" is shown literally, instead of converted to Italic text. @Michael: Must I file a bug report, or will you make a note about it?
Regards,
- Graeme -
To add to that, CurrencyFormat() shows in the docs as "deprecated", but it doesn't…
It will in 3.0:
http://www.freepascal.org/docs-html-3.0.0/rtl/sysutils/currencystring.html
Michael.
And here is a LateX issue in the docs for Format() Under the "M" currency format text it…
Already done.
Michael.
This is how it works with the %m format procedure TForm1.FormCreate(Sender: TObject);…
A) thank you guys!!!
B) Werner Pamler ...
Fazit: ... so its not possible to get the currency symbol ? using FormatCurr, that what i learned so far?!!
i was wrong interpreting the function name as delivering a formatted number plus(!!) the currency symbol!
"John Landmesser" wrotei was wrong interpreting the function name as delivering a formatted
number plus(!!) the currency symbol!
Because there might be cases in which you don't want the currency symbol. And better to manually add something than to remove something ;)
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150815/9175bf6f/attachment.html>