当前位置:主页 > 查看内容

asp 实现检测字符串是否为纯字母和数字组合的函数

发布时间:2021-07-31 00:00| 位朋友查看

简介:% '****************************** '函数:CheckString(strng) '参数:strng,待验证字符串 '作者:阿里西西 '日期:2007/7/13 '描述:检测字符串是否为纯字母和数字组合 '示例:%=CheckString(strng)% '****************************** FunctionCheckString……
<%
'******************************
'函数: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
%>

原文链接:https://m.jb51.net/article/10893.htm
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!
上一篇:asp代码实现检测组件是否安装的函数 下一篇:没有了

推荐图文


随机推荐