有两个条件判断和ASCII码转换的问题,怎么编译通不过,哪位能解答?var  ZoomClearDegree:Integer;
  LicensePrefix:String;  if ZoomClearDegree<-100 or ZoomClearDegree>200 then   //此行出错,类型不匹配
    begin
      ShowMessage('合成清晰度必须在(-100,200)之间!');
      Exit;
    end;  if asc(LicensePrefix)<65 or asc(LicensePrefix)>90 then  //此行出错,类型不匹配,ASC函数是哪个?  
    begin
      ShowMessage('号牌前缀必须在(A~Z)之间!');
      Exit;
    end;

解决方案 »

  1.   

    //括号
    if (ZoomClearDegree<-100) or (ZoomClearDegree>200) then   //此行出错,类型不匹配
        begin
          ShowMessage('合成清晰度必须在(-100,200)之间!');
          Exit;
        end;
      

  2.   

     if (ZoomClearDegree<-100) or (ZoomClearDegree>200) then加上括号
      

  3.   

    delphi里 and/or都要用()括起來
    ordord('A');
      

  4.   

    加上ord和()还是出错  LicensePrefix:=EditPreLicense.Text;
      if (ord(LicensePrefix)<65) or (ord(LicensePrefix)>90) then
        begin
          ShowMessage('号牌前缀必须在(A~Z)之间!');
          Exit;
        end;编程思路是从编辑框里取字符,有可能是一位到几位,如果不在A~Z的范围内,提示出错。
      

  5.   

      LicensePrefix:=trim(EditPreLicense.Text);//去掉空格
      for i:=1 to length(LicensePrefix) do      begin
          if (not LicensePrefix[i] in ['A'..'Z']) or
             (not LicensePrefix[i] in ['a'..'z']) then   //如果的第i个字不是A-Z或者a-z中的任一个
            begin
             ShowMessage('号牌前缀必须在(A~Z)之间!');
             Exit;
            end;
       
      

  6.   


    LicensePrefix:=EditPreLicense.Text;
      if (ord(StrToInt(LicensePrefix))<65) or (ord(StrToInt(LicensePrefix))>90) then
        begin
          ShowMessage('号牌前缀必须在(A~Z)之间!');
          Exit;
        end;
      

  7.   

    问题解决了,查了查万一的博客,写出了下面代码。一并感谢老于和SQL。
    将EditPreLicense的长度设为1  LicensePrefix:=EditPreLicense.Text;
      if Not IsCharUpper(LicensePrefix[1]) and Not IsCharLower(LicensePrefix[1]) then
        begin
          ShowMessage('号牌前缀必须在(A~Z)或(a~z)之间!');
          Exit;
        end;