var
  i: LongInt;
  f: Double;
begin
  if TryStrToInt(Edit1.Text,i) or TryStrToFloat(Edit1.Text, f) then
    ShowMessage('是数字')
  else
    ShowMessage('不是数字');
end;

解决方案 »

  1.   

    function IsDigital(Value: string): boolean;
    var
      i, j: integer;
      str: char;
    begin
      result := true;
      Value := trim(Value);
      j := Length(Value);
      if j = 0 then
      begin
        result := false;
        exit;
      end;
      for i := 1 to j do
      begin
        str := Value[i];
        if not (str in ['0'..'9']) then
        begin
          result := false;
          exit;
        end;
      end;
    end;  if IsDigital('123') then
        ShowMessage('数字');
      if IsDigital('a123') then
        ShowMessage('数字');