Numbering function by adding the number '0 'in front of the numbers. For example the maximum number is 1000, then you have the number 10, then the number 10 was going to set to 0010.
Function declaration:
autonumber_0 function (value, Maksvalue: Integer): String;
var
sNum: String;
begin
Result: = '0 ';
sNum: = IntToStr (value);
sNum: = StringOfChar ('0 ', Length (IntToStr (Maksvalue)) - Length (sNum)) + sNum;
Result: = sNum;
end;
Example of implementation:
procedure TForm1.Button1Click (Sender: TObject);
var
i, max: Integer;
begin
max: = 10;
for i: = 1 to max do
begin
ListBox1.Items.Add (autonumber_0 (i, max) + '. Numbers #' + IntToStr (i));
end;
end;
No comments:
Post a Comment