我再窗体里面建了一个 Edit 想通过判断 edit1.text 是否为字符串(如果是数字或其他标点符号则中止) 来决定是否 进行下一步~请问 怎么判断是否为字符串?谢~~
----------------------------------------------

解决方案 »

  1.   

    function IsDigital(Value: string): boolean;
    var
      i, j: integer;
      str: char;
    begin
      result := false;
      Value := trim(Value);
      j := Length(Value);
      if j = 0 then
      begin
        result := true;
        exit;
      end;
      for i := 1 to j do
      begin
        str := Value[i];
        if  (str in ['A'..'Z']) or (str in ['a'..'z'])  then
        begin
          result := true;
          exit;
        end;
      end;
    end;
      

  2.   

    s:=Edit1.Text;
    for i:=1 to length(s) do
    if not ((s[i] in ['a'..'z']) and (s[i] in ['A'..'Z'])) then 
    showMessage(inttostr(i));