Главная страница | назад





Article #16934: Formatting and displaying integers with commas

 Question and Answer Database

FAQ1934D.txt   Formatting and displaying integers with commas
Category   :Object Pascal
Platform    :All
Product    :All 32 bit  

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;



7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99