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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

  2021-03-18 我要评论
想了解asp 实现检测字符串是否为纯字母和数字组合的函数的相关内容吗,在本文为您仔细讲解的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:asp,实现检测字符串是否为纯字母和数字组合的函数,下面大家一起来学习吧。
<%
'******************************
'函数: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
%>

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们