How to format a string with 3 houses?

0

I have a code that concatenates the results typed in edits, I'm assigning a 0 for each reading so the values look like this:

Result: 030/060/090 /

More when I have a value that already has 3 decimal places so I would like to keep only 3 houses.

Result: 030/060/090/0120 /

procedure TfrmCadastroPedido.Button1Click(Sender: TObject);
 var
     i: integer;
begin
      //fazer a leitura de componentes edits com um nome especifico
      for i := 0 to ComponentCount - 1 do
      begin

         if (Copy((Components[i].Name),1,7) = 'edPrazo') and (Components[i].Tag = 1) then
         begin
            if TEdit(Components[i]).Text <> '0' then
             begin
                PrazoParcelasNF :=  PrazoParcelasNF + '0' + TEdit(Components[i]).Text  + '/' ;
             end;
         end;
      end;

       Memo1.Lines.Add(PrazoParcelasNF);

end;
    
asked by anonymous 14.03.2016 / 20:44

1 answer

2

Just add:

PrazoParcelasNF :=  PrazoParcelasNF + Format('%3.3d', [StrToInt(TEdit(Components[i]).Text)]) + '/';
    
14.03.2016 / 21:36