[fpc-pascal] Formatting Question

Jean SUZINEAU jean.suzineau at wanadoo.fr
Sat Apr 3 22:41:22 CEST 2021


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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20210403/02a3e44c/attachment.htm>


More information about the fpc-pascal mailing list