Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2023-02

Format an integer with thousandseparators by function format()

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

John Landmesser

Hi,

this one works, but i don't know why to devide the integer by 1:

 ??? fmt := '%.0n';
 ??? s1 := Format(fmt,[MyInteger/*1*]);

Lhelp tells me about function format, that does not work:

Show quoted text 6 lines
N Number format. This is the same as fixed point format, except that thousand separators are inserted in the resulting string.

Documentation generated on: Jun 27 2020

I'm on Lazarus 2.3.0 (rev main-2_3-2854-g0278edaea3) FPC 3.2.2 x86_64-linux-gtk2

Tipps are welcome

John Landmesser

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20230217/89aa6b4e/attachment.htm>

Reply by email

Michael Van Canneyt
to John Landmesser
John Landmesser wrote 7 lines
Hi, this one works, but i don't know why to devide the integer by 1: ??? fmt := '%.0n'; ??? s1 := Format(fmt,[MyInteger/*1*]);

Because the result of the division is a float; not an integer. And %n will only format a float, not an integer.

Michael.

Reply by email