如何判断一个字fu串是不是数字??简单点.

解决方案 »

  1.   

    try
      strtoint(yournumber)
    except
      //不是
    end;
      

  2.   

    不行,应该是
    try
      inttostr(字符串)
    except
    不是
    end;
    有问题请发信息到我的E-mail:[email protected]
      

  3.   

    不对,应该这样:
    function sfsz(s:string;):boolean
    begin
    result:=true;
    try
     if 有小数点 then
      strtofloat(s)
    else
    strtoint(s)
    except
    result:=false;
    end;
    end;
      

  4.   

    ft,netwolfds(晓竹) 说的是对的。楼上搞错了。
      

  5.   

    判断一个字符这么费事吗?if a in ['0'..'9'] then 
      是
    else 
      不是
      

  6.   

    if a in ['0'..'9'] then 
      是
    else 
      不是Try
      StrToInt(..)
    Except
      ;//不是
    end;if IsNumber(..) then
      ..
      

  7.   

    同意 pazee(耙子) 的
    这么一小点东西就搞得乱七八糟的。
      

  8.   

    if IsNumber(..) then
      ..
    //这个最简化,你认为呢?
      

  9.   

    StrToFloatDef(Str,0)等于0时不是数字StrToFloat利用异常机制,出错时不是数字