在Delphi中如何判断一个字符是 字母,数字? 有一个IsNumeric() 函数, 还有其它的呢?

解决方案 »

  1.   

    var
      ch:char;...
    if ch in [0..9] then
    begin
    数字
    end else
    begin
      if ch in[a..z,A..Z] then
      begin
      字母
      end else
      begin
        其他东西
      end
    end;
      

  2.   

    好象就一个IsNumberic函数..
    这小东西自己写个也简单啊..
      

  3.   

    同意一楼的...var
      ch:char;...
    if ch in [0..9] then
    begin
    数字
    end else
    begin
      if ch in[a..z,A..Z] then
      begin
      字母
      end else
      begin
        其他东西
      end
    end;
      

  4.   

    type
      TCharType = (ctAlphabet, ctNumber, ctOther);function GetCharType(ch:Char):TCharType;
    begin
      Result:= ctOther;
      if ch in ['0'..'9'] then Result:= ctNumber;
      if ch in ['A'..'Z', 'a'..'z'] then Reault:= ctAlphabet;
    end;