That looks almost perfect.. can I suppress the trailing zeros with the format 
command without losing the alignment? 
 
James  Richters

 <http://www.productionautomation.net> www.productionautomation.net 
 <mailto:ja...@productionautomation.net> ja...@productionautomation.net
                                      (813)-763-1110
 
From: fpc-pascal <fpc-pascal-boun...@lists.freepascal.org> On Behalf Of Jean 
SUZINEAU via fpc-pascal
Sent: Saturday, April 3, 2021 4:41 PM
To: fpc-pascal@lists.freepascal.org
Cc: Jean SUZINEAU <jean.suzin...@wanadoo.fr>
Subject: Re: [fpc-pascal] Formatting Question
 
Normally something like this should do the trick (here 3 decimals and 7 
characters for total width):
program Format_Example;
uses
    sysutils;
procedure F( _d: double);
var
   S: String;
begin
     S:= Format('%7.3f',[_d]);
     WriteLn( S);
end;

begin
     F(0.5);
     F(2.53);
     F(12.5);
end.
---------- Output ------------
  0.500
  2.530
 12.500
 
 
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to