加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

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

发布时间:2023-09-18 15:02:48 所属栏目:Asp教程 来源:
导读:示例:<%=CheckString(strng)%>

&#39;******************************

Function CheckString(strng)

CheckString = true

Dim regEx, Match

Set regEx = New RegExp

regEx.P
示例:<%=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
 
%>
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章