asp 实现检测字符串是否为纯字母和数字组合的函数
asp 实现检测字符串是否为纯字母和数字组合的函数
发布时间:2016-12-29 来源:查字典编辑
摘要:检测是否为中文字符

<%

'******************************

'函数:CheckString(strng)

'参数:strng,待验证字符串

'作者:阿里西西

'日期:2007/7/13

'描述:检测字符串是否为纯字母和数字组合

'示例:<%=CheckString(strng)%>

'******************************

FunctionCheckString(strng)

CheckString=true

DimregEx,Match

SetregEx=NewRegExp

regEx.Pattern="^[A-Za-z0-9]+$"

regEx.IgnoreCase=True

SetMatch=regEx.Execute(strng)

ifmatch.countthenCheckString=false

EndFunction

%>

检测是否为中文字符

<%

'******************************

'函数:CheckChinese(strng)

'参数:strng,待验证字符

'作者:阿里西西

'日期:2007/7/13

'描述:检测是否为中文字符,返回值:中文为true,否则false

'示例:<%=CheckChinese(strng)%>

'******************************

FunctionCheckChinese(strng)

CheckChinese=true

DimregEx,Match

SetregEx=NewRegExp

regEx.Pattern="||#|&|?|@|%|*|/|.|,|;|'|:|-|_|+|^|""|=|<|>|"

regEx.IgnoreCase=True

SetMatch=regEx.Execute(strng)

ifmatch.countthenCheckChinese=false

EndFunction

%>

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新ASP教程学习
热门ASP教程学习
编程开发子分类