0123 bis 0147:
Delphi-Quellcode:
var i : Integer;
s : String;
begin
i := 122;
repeat
inc(i);
s := Format('%.4d',[i]);
//irgendwas tun
until i=147;
end;
Wenn Du die Nullen wieder entfernen willst:
Delphi-Quellcode:
function RemoveLeadingZeros(var aValue: String): String;
begin
While (Copy(aValue,1,1) = '0') Do Delete(aValue,1,1);
Result:= aValue;
end;
//oder
function RemoveLeadingZeros2(const aValue: String): String;
begin
Result := IntToStr(StrToIntDef(aValue,0));
end;