• 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  更新时间:

  • 相关阅读:
    stm8s103 EEPROM烧程序时能否保留
    NEC芯片特别说明
    pic中断特别说明
    删除排序链表中的重复元素 II
    被围绕的区域
    计数二进制子串
    简单工厂模式
    打家劫舍 II
    打家劫舍
    相同的树
  • 原文地址:https://www.cnblogs.com/guorongtao/p/13254539.html
Copyright © 2020-2023  润新知