如何判断一个字符串是不是都是有数字组成的(用delphi)?例如19482984是的,343jjlj4333j3就不是
我想用ASC码来比较,不知道如何实现?

解决方案 »

  1.   

    function TryStrToFloat(const S: string; out Value: Extended): Boolean; overload
    ;function TryStrToFloat(const S: string; out Value: Double): Boolean; overload;
    function TryStrToFloat(const S: string; out Value: Single): Boolean; overload;function TryStrToFloat(const S: string; out Value: Extended; const FormatSettings: TFormatSettings): Boolean; overload;function TryStrToFloat(const S: string; out Value: Double; const FormatSettings: TFormatSettings): Boolean; overload;
    function TryStrToFloat(const S: string; out Value: Single; const FormatSettings: TFormatSettings): Boolean; overload;
      

  2.   

    另外一个方法
    for i:=1 to length(s) do
    begin
      if (s[i]>='9') or (s[i]<='0') then
      begin
        showmessage('不是');
        exit;
      end;
    end;
    showmessage('是');