您当前位置: 首页 >  WEB技术 >  asp 实现检测字符串是否为纯字母和数字组合的函数(2个方法)
2016/5/21 14:48:39 分类:WEB技术

asp 实现检测字符串是否为纯字母和数字组合的函数(2个方法)

 <% 
\'****************************** 
\'函数:CheckString(strng) 
\'参数:strng,待验证字符串 
\'作者:阿里西西 
\'日期:2007/7/13 
\'描述:检测字符串是否为纯字母和数字组合 
\'示例:<%=CheckString(strng)%> 
\'****************************** 
Function CheckString(strng) 
    CheckString = true 
    Dim regEx, Match 
    Set regEx = New RegExp 
    regEx.Pattern = "^[A-Za-z0-9]+$" 
    regEx.IgnoreCase = True 
    Set Match = regEx.Execute(strng) 
    if match.count then CheckString= false 
End Function 
%>
检测是否为中文字符
<% 
\'****************************** 
\'函数:CheckChinese(strng) 
\'参数:strng,待验证字符 
\'作者:阿里西西 
\'日期:2007/7/13 
\'描述:检测是否为中文字符,返回值:中文为true,否则false 
\'示例:<%=CheckChinese(strng)%> 
\'****************************** 
Function CheckChinese(strng) 
    CheckChinese = true 
    Dim regEx, Match 
    Set regEx = New RegExp 
    regEx.Pattern = "\\||\\#|\\&|\\?|\\@|\\%|\\*|\\/|\\.|\\,|\\;|\\\'|\\:|\\-|\\_|\\+|\\^|\\""|\\=|\\<|\\>|\\ " 
    regEx.IgnoreCase = True 
    Set Match = regEx.Execute(strng) 
    if match.count then CheckChinese= false 
End Function 
%>

本文由胡金金个人网站整理发布,转载请注明地址:http://www.hujinjin.com/info/628.html

凡标明来源于胡金金个人网站的文章,皆为本站整理发布,若转载此文必须附原文链接,对部分平台更改其文内容当自己原创者,胡金金个人网站将保留其追究权利!
个人资讯推荐
友情链接