function formatinttostr(i:integer;w:integer):string;
var
stmp:string;
itmp:integer;
begin
stmp:= format('%'+inttostr(w)+'d',);
itmp:=1;
while (itmp<= length(stmp)) do
begin
if (stmp[itmp]=' ') then stmp[itmp]='0';
itmp:= itmp+1;
end;
result:= stmp;
end;
试试行不行?
function FormatInt(const aInt, aiNum: Integer): string;
begin
Result := IntToStr(aInt);
while Length(Result) < aiNum do
Insert(Result, 1, '0');
end;