0.5
2.53
12.5
Thanks! That’s exactly that I was looking for. Thank you for sharing your
code!
James
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
tomation.net
(813)-763-1110
From: fpc-pascal 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
Subject: Re: [fpc-pascal] Formatting Question
Normally something like this should do the t
Le 04/04/2021 à 02:41, James Richters a écrit :
That looks almost perfect.. can I suppress the trailing zeros with the
format command without losing the alignment?
As far as I know, no ...
Not with just the RTL.
Anyway I have personal code for this, you can extract and customize it
to yours
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);
Hi,
I tried this (add StrUtils to uses):
procedure TForm1.Button1Click(Sender: TObject);
var i, l: Integer;
aV: Double;
aF: TFormatSettings;
begin
aF.DecimalSeparator:='.';
aF.ThousandSeparator:=' ';
for i:=-2 to 10 do
begin
aV:=pi*power(10, i);
l:=length(intToStr
You can always convert the number to a string, then format it
accordingly. It's probably not the solution you want, but it will do
the trick.
On 4/3/2021 11:43 AM, James Richters via fpc-pascal wrote:
I'm looking for a way to format numerical data in a string so that everything
ends up align