如:a=‘12’
格式后a='00012'

解决方案 »

  1.   

    如果你的字符只有整数的话。
    var
     s:string;
     i:integer;s:=format('%.5d',[i]);
      

  2.   

    如果a是Integer,那么
    Format('%0.5u',[a])
      

  3.   


    Format('x=%d', [12]); //'x=12' //最普通Format('x=%3d', [12]); //'x= 12' //指定宽度Format('x=%f', [12.0]); //'x=12.00' //浮点数Format('x=%.3f', [12.0]); //'x=12.000' //指定小数Format('x=%.*f', [5, 12.0]); //'x=12.00000' //动态配置Format('x=%.5d', [12]); //'x=00012' //前面补充0Format('x=%.5x', [12]); //'x=0000C' //十六进制Format('x=%1:d%0:d', [12, 13]); //'x=1312' //使用索引Format('x=%p', [nil]); //'x=00000000' //指针Format('x=%1.1e', [12.0]); //'x=1.2E+001' //科学记数法Format('x=%%', []); //'x=%' //得到"%"S := Format('%s%d', [S, I]); //S := S + StrToInt(I); //连接字符串
    抄的!