本文整理自网络,侵删。
感谢代码由smkf225@vip.qq.com(89758365) 分享:
function Padstring (Str: string; Len: Integer; Padstr: Char) : string ;beginResult := StringOfChar (PadStr, Len -Length (Str) ) + Str;end;
procedure TForm1.Button1Click(Sender: TObject);var I: Integer;beginfor I := 1 to 1000 dobegin Memo1.Lines.Add('A' + Padstring(IntToStr(I), 3,'0'));end;
end;
第二种:www.xuexidashi.vip 提供procedure TForm1.Button3Click(Sender: TObject);var I: Integer; bmstr:string;beginbmstr:='a'+'%.'+Length(IntToStr(100)).ToString+'d';for I := 1 to 100 dobegin Memo1.Lines.Add(Format(bmstr,[i]));end;
end;
第三种:var I: Integer;beginfor I := 1 to 100 dobegin Memo1.Lines.Add(format('a%4d',[I]));end;
相关阅读 >>
Delphi program name、process id、window handle、process handle 的转换函数
Delphi tstringlist 自带 split 用法
Delphi unigui unistringgrid1 清空
Delphi blockread和blockwrite读写文件
更多相关阅读请进入《Delphi》频道 >>