如题: 整数123,长度是不固定的,也可能是1,12,1234

解决方案 »

  1.   

    var zz1,zz2,zz3:string;zz,i:integer;
    begin
    zz3:='1234';
    zz:=length(zz3);
    zz1:=' ';
    for i:=1 to 12-zz do
    zz1:=zz1+'0';
    zz2:=zz1+zz3;
    showmessage(zz2);
      

  2.   

    这个简单,计算    12-length(这个整数),然后给这个整数前面补这么多0。
      

  3.   

    例如abc为你说的整数,写法如下:copy(floattostr(strtofloat(inttostr(abc))+1000000000000),2,12)结果为你想要的
      

  4.   

    function DupeString(const AText: string; ACount: Integer): string;DupeString returns a string containing ACount repeats of the string specified by AText. For example,S := DupeString('Ha', 5);sets S to the string 'HaHaHaHaHa'.
      

  5.   

    while length(str) < 12 do
    begin
      str := '0' + str;
    end;
      

  6.   


    DupeString
    Returns the concatenation of a string with itself a specified number of repeats.UnitStrUtilsCategorystring handling routinesDelphi syntax:function DupeString(const AText: string; ACount: Integer): string;C++ syntax:extern PACKAGE AnsiString __fastcall DupeString(const AnsiString AText, int ACount);DescriptionDupeString returns a string containing ACount repeats of the string specified by AText. For example,S := DupeString('Ha', 5);sets S to the string 'HaHaHaHaHa'.
      

  7.   

    简单:
        function MyFun(i:Integer):String; 
        begin
           i:=1000000000000+i;
           Result:=copy(IntToStr(i),2,12)
        end;