如题,谢谢先!

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      a:string;
      i:integer;
    begin
      a:='2.00';
      a:=FloatTOStr(StrToFloat(a));
      i:=Pos('.',a);
      if i>0 then
        SHowmessage('Real')
        else
        SHowMessage('Int');
    end;
      

  2.   

    还得先自己判断一下这个字符串否全是数字!
    >>>可以用异常来处理
      

  3.   

    谢谢dy兄,我自己搞定了。使用函数StrToIntDef(),
    MID:string;
    if StrToIntDef(MID,-1)=-1 then MID 不是数字。
      

  4.   

    try 
      strtoint();
    except
      // 
    end;
      

  5.   

    StrToInt
    看是否抛出异常,如果有异常当然就不是了·
      

  6.   

    var
       intValue: Int64;
       intCode: Integer;
    begin
       Val(strValue, intValue, intCode);
       if intCode > 0 then
          ShowMessage('It is not Integer.')
       else
          ShowMessage('Is is Integer.');
    end;
      

  7.   

    try 
      strtoint(...);
    except
      showmessage('not integer');
    end;
      

  8.   

    try
        showmessage(inttostr(strtoint(edit1.Text)));
      except
        ShowMessage('No');
      end;
      

  9.   

    补充一下,当字符串对应的整数大于int的最大值,即2147483647时,应使用StrToFloatDef(),而不是StrToIntDef().