自己编一个函数:
//3是总的位数
for i=:0 to 3-length(yourstring) do
    yourstring:='0'+yourstring;

解决方案 »

  1.   

    这个我知道。我是说用format
      

  2.   

    自编函数吧!yukuang(天才??) 兄,不要偷懒!
      

  3.   

    C++中有sprintf和wsprintf,不知道DELPHI有没有?
    int x=5;
    char buf[32];
    sprintf(buf,"%03d",x);
    buf将有"005"
      

  4.   

    哈,DELPHI中应该有wsprintf(buf,%03d",x);  //因为这是API中的函数int wsprintf(
        LPTSTR lpOut, // pointer to buffer for output 
        LPCTSTR lpFmt,  // pointer to format-control string 
        ... // optional arguments
       );
     
    %[-][#][0][width][.precision]type0  Pad the output value with zeros to fill the field width. If this field is omitted, the output value is padded with blank spaces.试一试,API中用就成了