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:[email protected]> [email protected] (813)-763-1110 From: fpc-pascal <[email protected]> On Behalf Of Jean SUZINEAU via fpc-pascal Sent: Saturday, April 3, 2021 4:41 PM To: [email protected] Cc: Jean SUZINEAU <[email protected]> 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 - [email protected] https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
