zoukankan      html  css  js  c++  java
  • 中文姓名的VbScript验证方法

            <script language=vbscript>
            
    'xm 姓名
            function valiName(xm)
                ret 
    = true
                
    for i = 1 to len(xm)
                    
    if asc(mid(xm, i, 1)) >= 0 and asc(mid(xm, i, 1)) <= 128 then
                        ret 
    = false
                        
    exit for
                    
    end if
                
    next
                valiName 
    = ret
            
    end function
            
            
    'mc 名称
            'g 不能连续出现的英文字符
            'h 不能连续出现的相同的中文字符
            function valiNameContinuousChar(mc, g, h)
                c 
    = 0 : d = 0
                b 
    = false
                last 
    = ""
                
    for i = 1 to len(mc)
                    
    if last <> "" and last = mid(mc, i, 1then
                        d 
    = d + 1
                    
    end if
                    
    if asc(mid(mc, i, 1)) > 0 then
                        
    if not b then
                            b 
    = true
                        
    end if
                        c 
    = c + 1
                        
    if c >= g then exit for
                    
    else
                        b 
    = false
                        c 
    = 0
                    
    end if
                    last 
    = mid(mc, i, 1)
                
    next
                valiNameContinuousChar 
    = c < g and d <= h - 2
            
    end function
            
    </script>
  • 相关阅读:
    CareerCup Questions List 职业杯题目列表
    [CareerCup] Guards in a museum 博物馆的警卫
    [LeetCode] 7. Reverse Integer 翻转整数
    Python笔记11------一个K-means聚类的小例子
    python笔记10-----便捷网络数据NLTK语料库
    Python笔记9-----不等长列表转化成DataFrame
    Python笔记8----DataFrame(二维)
    Python笔记7----Pandas中变长字典Series
    Python笔记6----数组
    Python笔记5----集合set
  • 原文地址:https://www.cnblogs.com/faib/p/797718.html
Copyright © 2011-2022 走看看