请问把int型,转换成string型的函数是什么???
请教其他的函数

解决方案 »

  1.   

    IntToStr();
    Int64ToStr();//用于更长的整型值
      

  2.   

    floattostring适用于一切数(自己模拟的除外)转换成string形式!!
      

  3.   

    其他的函数,我有一个Word文件,您要的话,请给我电子邮件!
      

  4.   

    //from
    http://zswang.51.net/document/zsdoc02.txt━━━━━━━━━━━━━━━━━━━━━
    首部  function IntToStr(Value: Integer): string; overload; $[SysUtils.pas
    首部  function IntToStr(Value: Int64): string; overload; $[SysUtils.pas
    功能  返回整数Value转换成字符串
    说明  Format('%d', [Value])
    参考  function SysUtils.FmtStr
    例子  Edit2.Text := IntToStr(SpinEdit1.Value);
    ━━━━━━━━━━━━━━━━━━━━━
    首部  function IntToHex(Value: Integer; Digits: Integer): string; overload; $[SysUtils.pas
    首部  function IntToHex(Value: Int64; Digits: Integer): string; overload; $[SysUtils.pas
    功能  返回整数Value转换成十六进制表现结果;Format('%.*x', [Digits, Value])
    说明  参数Digits指定字符最小宽度;最小宽度不足时将用0填充
    参考  function SysUtils.FmtStr
    例子  Edit2.Text := IntToHex(SpinEdit1.Value, SpinEdit2.Value);
    ━━━━━━━━━━━━━━━━━━━━━
    首部  function StrToInt(const S: string): Integer; $[SysUtils.pas
    功能  返回字符串S转换成整数
    说明  字符串非整数表达时将引起异常
    参考  procedure System.Val
    例子  SpinEdit1.Value := StrToInt(Edit1.Text);
    ━━━━━━━━━━━━━━━━━━━━━
    首部  function StrToIntDef(const S: string; Default: Integer): Integer; $[SysUtils.pas
    功能  返回字符串S转换成整数
    说明  字符串非整数表达时则返回默认值Default
    参考  procedure System.Val
    例子  SpinEdit1.Value := StrToIntDef(Edit1.Text, 0);
    ━━━━━━━━━━━━━━━━━━━━━
    首部  function TryStrToInt(const S: string; out Value: Integer): Boolean; $[SysUtils.pas
    功能  返回字符串S转换成整数Value是否成功
    说明  字符串非整数表达时返回False并且Value将输出为0
    参考  procedure System.Val
    例子
    ///////Begin TryStrToInt
    procedure TForm1.Button1Click(Sender: TObject);
    var
      I: Integer;
    begin
      CheckBox1.Checked := TryStrToInt(Edit1.Text, I);
      SpinEdit1.Value := I;
    end;
    ///////End TryStrToInt
    ━━━━━━━━━━━━━━━━━━━━━
    首部  function StrToInt64(const S: string): Int64; $[SysUtils.pas
    功能  返回字符串S转换成六十四位整数
    说明  字符串非六十四位整数表达时将引起异常
    参考  procedure System.Val
    例子  SpinEdit1.Value := StrToInt64(Edit1.Text);
    ━━━━━━━━━━━━━━━━━━━━━
    首部  function StrToInt64Def(const S: string; const Default: Int64): Int64; $[SysUtils.pas
    功能  返回字符串S转换成六十四位整数
    说明  字符串非六十四位整数表达时则返回默认值Default
    参考  procedure System.Val
    例子  SpinEdit1.Value := StrToInt64Def(Edit1.Text, 0);
    ━━━━━━━━━━━━━━━━━━━━━
    首部  function TryStrToInt64(const S: string; out Value: Int64): Boolean; $[SysUtils.pas
    功能  返回字符串S转换成六十四位整数Value是否成功
    说明  字符串非六十四位整数表达时返回False并且Value将输出为0
    参考  procedure System.Val
    例子
    ///////Begin TryStrToInt64
    procedure TForm1.Button1Click(Sender: TObject);
    var
      I: Int64;
    begin
      CheckBox1.Checked := TryStrToInt64(Edit1.Text, I);
      SpinEdit1.Value := I;
    end;
    ///////End TryStrToInt64
    ━━━━━━━━━━━━━━━━━━━━━
    首部  function StrToBool(const S: string): Boolean; $[SysUtils.pas
    功能  返回字符串S转换成逻辑值
    说明  字符非逻辑表达时将引起异常
    参考  function SysUtils.TryStrToBool
    例子  CheckBox1.Checked := StrToBool(Edit1.Text);
    ━━━━━━━━━━━━━━━━━━━━━
    首部  function StrToBoolDef(const S: string; const Default: Boolean): Boolean; $[SysUtils.pas
    功能  返回字符串S转换成逻辑值
    说明  字符非逻辑表达时则返回默认值Default
    参考  function SysUtils.TryStrToBool
    例子  CheckBox1.Checked := StrToBoolDef(Edit1.Text, False);
    ━━━━━━━━━━━━━━━━━━━━━
    首部  function TryStrToBool(const S: string; out Value: Boolean): Boolean; $[SysUtils.pas
    功能  返回字符串S转换成逻辑值Value是否成功
    说明  [注意]0为假非0为真;不是'True'和'False';Delphi6 Bug 如下修正
    参考  function SysUtils.AnsiSameText;var SysUtils.TrueBoolStrs;var SysUtils.FalseBoolStrs
    例子
    ///////Begin TryStrToBool
    procedure TForm1.Button1Click(Sender: TObject);
    var
      B: Boolean;
    begin
      SetLength(TrueBoolStrs, 2);
      SetLength(FalseBoolStrs, 2);
      TrueBoolStrs[0] := 'True';
      FalseBoolStrs[0] := 'False';
      TrueBoolStrs[1] := 'Yes';
      FalseBoolStrs[1] := 'No';
      CheckBox1.Checked := TryStrToBool(Edit1.Text, B);
      CheckBox2.Checked := B;
    end;
    ///////End TryStrToBool
    附加
    ///////Begin TryStrToBool
    function TryStrToBool(const S: string; out Value: Boolean): Boolean;
      function CompareWith(const aArray: array of string): Boolean;
      var
        I: Integer;
      begin
        Result := False;
        for I := Low(aArray) to High(aArray) do
          if AnsiSameText(S, aArray[I]) then
          begin
            Result := True;
            Break;
          end;
      end;
    var
      LResult: Extended;
    begin
      Result := TryStrToFloat(S, LResult);
      if Result then
        Value := LResult <> 0
      else
      begin
        Result := True; //修正处
        VerifyBoolStrArray;
        if CompareWith(TrueBoolStrs) then
          Value := True
        else if CompareWith(FalseBoolStrs) then
          Value := False
        else
          Result := False;
      end;
    end;
    ///////End TryStrToBool
    ━━━━━━━━━━━━━━━━━━━━━
    首部  function BoolToStr(B: Boolean; UseBoolStrs: Boolean = False): string; $[SysUtils.pas
    功能  返回逻辑值B转换成字符串
    说明  BoolToStr(False, False)='0';BoolToStr(False, True)='-1'
    参考  var SysUtils.TrueBoolStrs;var SysUtils.FalseBoolStrs
    例子  Edit1.Text := BoolToStr(CheckBox1.Checked, CheckBox2.Checked);
    ━━━━━━━━━━━━━━━━━━━━━
      

  5.   

    一般地用IntToStr()即可;
    对于数据范围较大的可用
    Int64ToStr(),当然若是Float型的可用FloattoStr();