Delphi 如何判断一个字符串是否全为字母?

来源:百度知道 编辑:UC知道 时间:2024/05/23 17:42:41
Delphi 如何判断一个字符串是否全为字母?
大虾帮忙?

function IsEnCase(Vaule:String):boolean; //判断Vaule 是不是字母
var
i:integer;
begin
result:=true; //设置返回值为 是
Vaule:=trim(Vaule); //去空格
for i:=1 to length(Vaule) do //准备循环
begin
if (not Vaule[i] in ['A'..'Z']) or
(not Vaule[i] in ['a'..'z']) then //如果Vaule的第i个字不是A-Z或者a-z中的任一个
begin
result:=false; //返回值 不是
exit; //退出函数
end;
end;
end;

for i:=1 to length(str)
begin
if not (((ord(str[i])>=67) and (ord(str[i])<=90)) or
((ord(str[i])>=97) and (ord(str[i])<=122))) then
begin result:=false;
break ;
end
end;