有两个条件判断和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;
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;
if (ZoomClearDegree<-100) or (ZoomClearDegree>200) then //此行出错,类型不匹配
begin
ShowMessage('合成清晰度必须在(-100,200)之间!');
Exit;
end;
ordord('A');
if (ord(LicensePrefix)<65) or (ord(LicensePrefix)>90) then
begin
ShowMessage('号牌前缀必须在(A~Z)之间!');
Exit;
end;编程思路是从编辑框里取字符,有可能是一位到几位,如果不在A~Z的范围内,提示出错。
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;
LicensePrefix:=EditPreLicense.Text;
if (ord(StrToInt(LicensePrefix))<65) or (ord(StrToInt(LicensePrefix))>90) then
begin
ShowMessage('号牌前缀必须在(A~Z)之间!');
Exit;
end;
将EditPreLicense的长度设为1 LicensePrefix:=EditPreLicense.Text;
if Not IsCharUpper(LicensePrefix[1]) and Not IsCharLower(LicensePrefix[1]) then
begin
ShowMessage('号牌前缀必须在(A~Z)或(a~z)之间!');
Exit;
end;