你还是看这个吧
procedure FmtStr(var Result: string; const Format: string;
  const Args: array of const);
var
  Len, BufLen: Integer;
  Buffer: array[0..4095] of Char;
begin
  BufLen := SizeOf(Buffer);
  if Length(Format) < (sizeof(Buffer) - (sizeof(Buffer) div 4)) then
    Len := FormatBuf(Buffer, sizeof(Buffer) - 1, Pointer(Format)^, Length(Format), Args)
  else
  begin
    BufLen := Length(Format);
    Len := BufLen;
  end;
  if Len >= BufLen - 1 then
  begin
    while Len >= BufLen - 1 do
    begin
      Inc(BufLen, BufLen);
      Result := '';          // prevent copying of existing data, for speed
      SetLength(Result, BufLen);
      Len := FormatBuf(Pointer(Result)^, BufLen - 1, Pointer(Format)^,
      Length(Format), Args);
    end;
    SetLength(Result, Len);
  end
  else
    SetString(Result, Buffer, Len);
end;

解决方案 »

  1.   

    还真是看不明白 netlib(河外孤星) 给的过程,期待高手来指明!
    不过longinttostr为什么不自己写一个呢!
    逐个地取出每一位的数字,换成字符填入字符串不难吧!
      

  2.   

    呵呵,如果他们都让自己写longinttostr,不能用inttostr,那每一位数字如何转换,我看 boby(风之痕迹)要好好研究上面那个过程了(我真的,我也没看明白)。
      

  3.   

    呵呵,这样子是不是你要的结果??function LongIntToStr(N: LongInt): String;
    var m: Integer;
    begin
      Result := '';
      While N div 10 > 0 do
      begin
        m := N mod 10;
        Result := Char(m + Ord('0')) + Result;
        N := N div 10;
      end;
      m := N mod 10;
      Result := Char(m + Ord('0')) + Result;
    end;