Mega Code Archive

 
Categories / Delphi / Examples
 

Formatting and displaying integers with commas

Question: How can I easily display an integer value with commas every three digits? Answer: The following example demonstrates displaying an integer value with thousand separators. Note that the actual character used to separate the digits will depend on the local (country) system settings. procedure TForm1.Button1Click(Sender: TObject); var i : integer; begin i := 12345678; Memo1.Lines.Add(FormatFloat('#,', i)); end;