我这里分别以VC和Delphi举例:
比如想生成 000005,000255 这样的字符串
先看VC的: int i=5; CString strOut; strOut.Format("%.6d",i); AfxMessageBox(strOut);
i=255; strOut.Format("%.6d",i); AfxMessageBox(strOut);
类似的,Delphi 就是下面这样,差不多:var i:integer; strOut:string;begin i:=5; strOut:=Format('%.6d',[i]); showmessage(strOut);
i:=255; strOut:=Format('%.6d',[i]); showmessage(strOut);end;
转载于:https://www.cnblogs.com/forads/archive/2010/07/29/2161113.html