当前位置: 首页 > 图文教程 > 网络编程 > ASP > asp 实现检测字符串是否为纯字母和数字组合的函数

ASP
ASP+XML实例演练编程代码
asp下利用XMLHTTP 从其他页面获取数据的代码
asp下实现IP限制函数代码
asp下IP地址分段计算函数
asp身份证验证代码函数
用Asp隐藏文件路径,实现防盗链 的代码
ASP生成柱型体,折线图,饼图源代码提供了
用asp实现网址和邮件地址的转换函数
asp下最简洁的多重查询的解决方案
asp下用datediff实现计算两个时间差的函数
asp下实现记录集内随机取记录的代码
asp下轻松实现将上传图片到数据库的代码
[原创]站长感慨asp编程究竟何去何从
fso asp生成静态html的代码
ASP版实现cookies注入加速工具
ASP实现网页打开任何类型文件都提示保存的方法附代码
asp下使用数组存放数据的代码
一句话 asp木马加密版 彻底突破杀毒软件
asp清空application的方法
使用asp下的adodb.stream 下载文件而不是打开

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 71 ::
收藏到网摘: n/a

<%
'******************************
'函数: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
%>