zoukankan      html  css  js  c++  java
  • 判断字符是否为整数、浮点型小数、字符串

    function TForm_fangyuanhuizong_tubiao.IsNumber(s: string): integer;     //判断是否为整数、浮点型小数、字符串
    var  
    i   :   integer;
    begin
          result   :=   2;
          for   i   :=   1   to   Length(s)   do  
          begin  
              if   (s[i]   <   '0')   or   (s[i]   >   '9')   then  
              begin  
                  if   (s[i]   =   '.')   and   (i   <>   1)   and   (i   <>   Length(s))   then  
                  begin  
                      if   result   =   1   then  
                      begin  
                          result   :=   2;  
                          Exit;  
                      end;  
                      result   :=   1;  
                      continue;  
                  end;  
       
                  exit;  
              end;  
          end;  
          if   result   <>   1   then   result   :=   0;

          //返回   0   --   integer     1   --   double         2   ---string
    end;

  • 相关阅读:
    背水一战 Windows 10 (90)
    背水一战 Windows 10 (89)
    背水一战 Windows 10 (88)
    背水一战 Windows 10 (87)
    背水一战 Windows 10 (86)
    背水一战 Windows 10 (85)
    背水一战 Windows 10 (84)
    背水一战 Windows 10 (83)
    背水一战 Windows 10 (82)
    背水一战 Windows 10 (81)
  • 原文地址:https://www.cnblogs.com/lantianhf/p/5778540.html
Copyright © 2011-2022 走看看