Delphi 判断字符串是否是数字、大小字母、小写字母、纯字母组成

 

Delphi 判断字符串是否是数字、大小字母、小写字母、纯字母组成

 //判断字符串是否是数字 ,返回布尔值
function IsNumberic(Vaule:String):Boolean;  
var
i:integer;
begin
result:=true;   //设置返回值为 是(真)
Vaule:=trim(Vaule);  //去空格
  for i:=1 to length(Vaule) do  //准备循环
    begin
      if not (Vaule[i] in ['0'..'9']) then  //如果Vaule的第i个字不是0-9中的任一个
        begin
          result:=false;  //返回值 不是(假)
          exit;  //退出函数
        end;
    end;
end;

//判断字符串是否是大写字母,返回布尔值
function IsUpperCase(Vaule:String):Boolean;   
var
i:integer;
begin
result:=true;  //设置返回值为 是
Vaule:=trim(Vaule);   //去空格
  for i:=1 to length(Vaule) do   //准备循环
    begin
      if not (Vaule[i] in ['A'..'Z']) then  //如果Vaule的第i个字不是A-Z中的任一个
        begin
          result:=false;  //返回值 不是
          exit;  //退出函数
        end;
    end;
end;

 //判断字符串是否是小写字母,返回布尔值
function IsLowerCase(Vaule:String):Boolean; 
var
i:integer;
begin 
result:=true;   //设置返回值为 是
Vaule:=trim(Vaule);   //去空格
  for i:=1 to length(Vaule) do   //准备循环
    begin
      if not (Vaule[i] in ['a'..'z']) then   //如果Vaule的第i个字不是a-z中的任一个
        begin
          result:=false;   //返回值 不是
          exit;   //退出函数
        end;
    end;
end;

 //判断 字符串 是不是由字母组成,返回布尔值
function IsEnCase(Vaule:String):boolean;   
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;

  

 

 

 

创建时间:2020.07.06  更新时间:

 

posted on 2020-07-06 14:18  滔Roy  阅读(1147)  评论(0编辑  收藏  举报

导航