请赐教。

解决方案 »

  1.   

    strtoint()
    你这是检验一个串是否为数字串?
    错了吧
    这是将一字符转换成整型!
    function StrToInt(const S: string): Integer;
      

  2.   

    function IsInt(AStr: string): Boolean;
    var
      Value, Code: Integer;
    begin
      Val(AStr, Value, Code);
      Result := Code = 0;
    end;function IsFloat(AStr: string): Boolean;
    var
      Value: Real;
      Code: Integer;
    begin
      Val(AStr, Value, Code);
      Result := Code = 0;
    end;
      

  3.   

    还有StrToCurr()
    function StrToCurr(const S: string): Currency;
    把字符串转换成货币型!StrToFloat()
    function StrToFloat(const S: string): Extended;
    把字符串转换成浮点型!
      

  4.   

    Delphi's help:
    /////////////////////////
    Val exampleuses Dialogs;
    var   I, Code: Integer;
    begin
      { Get text from TEdit control }
      Val(Edit1.Text, I, Code);
      { Error during conversion to integer? }
      if Code <> 0 then
        MessageDlg('Error at position: ' + IntToStr(Code), mtWarning, [mbOk], 0, mbOk);
      else
        Canvas.TextOut(10, 10, 'Value = ' + IntToStr(I));end;
      

  5.   

    没有你说的那种方式啊一般都是用这样的东西try
      StrToInt(S);
      ShowMessage('是');
    Except
      ShowMessage('不是');
    end;
      

  6.   


    这不就是现成的函数吗?一个是判断是否整形的,一个是判断是否浮点型。function IsInt(AStr: string): Boolean;
    var
      Value, Code: Integer;
    begin
      Val(AStr, Value, Code);
      Result := Code = 0;
    end;function IsFloat(AStr: string): Boolean;
    var
      Value: Real;
      Code: Integer;
    begin
      Val(AStr, Value, Code);
      Result := Code = 0;
    end;
      

  7.   

    有现成的为什么不用
    TryStrToInt(S)
    TryStrToTime(S)
    TryStrToFloat(S)
    Try...To...(S)