日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

delphi?判斷字符串是否為純字母組合的函數_Delphi

更新時間: 2023-01-30 編程語言

代碼一

function IsEnCase(Vaule:String):boolean; //判斷字符串是否為純字母組合
var
i:integer;
begin
Vaule:=trim(Vaule); //去空格知
for i:=1 to length(Vaule) do //準備循環
begin
if ( Vaule[i] in ['A'..'Z']) or ( Vaule[i] in ['a'..'z']) then //如果Vaule的第i個字不道是A-Z或者a-z中的任一個回
begin
result:=true; //返回值 不是
end
else
begin
result:=false; //設置返度回值為 是
exit;
end;
end;
end;

Delphi判斷字符串是否是數字、字母、大小寫字母

function IsNumberic(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 ['0'..'9']) then  //如果Vaule的第i個字不是0-9中的任一個
        begin
          result:=false;  //返回值 不是(假)
          exit;  //退出函數
        end;
    end;
end;

function IsUpperCase(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']) then  //如果Vaule的第i個字不是A-Z中的任一個
        begin
          result:=false;  //返回值 不是
          exit;  //退出函數
        end;
    end;
end;

function IsLowerCase(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']) then   //如果Vaule的第i個字不是a-z中的任一個
        begin
          result:=false;   //返回值 不是
          exit;   //退出函數
        end;
    end;
end;

同理 如果想判斷是不是字母的話

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;
欄目分類
最近更新