asp 實現(xiàn)檢測字符串是否為純字母和數(shù)字組合的函數(shù)
更新時間:2007年08月08日 12:04:31 作者:
<%
'******************************
'函數(shù):CheckString(strng)
'參數(shù):strng,待驗證字符串
'作者:阿里西西
'日期:2007/7/13
'描述:檢測字符串是否為純字母和數(shù)字組合
'示例:<%=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
%>
檢測是否為中文字符
<%
'******************************
'函數(shù):CheckChinese(strng)
'參數(shù):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
%>
'******************************
'函數(shù):CheckString(strng)
'參數(shù):strng,待驗證字符串
'作者:阿里西西
'日期:2007/7/13
'描述:檢測字符串是否為純字母和數(shù)字組合
'示例:<%=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
%>
檢測是否為中文字符
<%
'******************************
'函數(shù):CheckChinese(strng)
'參數(shù):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
%>
相關(guān)文章
ReplaceTrim 函數(shù)之a(chǎn)sp實現(xiàn)過濾掉字符中所有的tab和回車和換行的代碼
ReplaceTrim 函數(shù)之a(chǎn)sp實現(xiàn)過濾掉字符中所有的tab和回車和換行的代碼...2007-09-09asp下根據(jù)標(biāo)題生成關(guān)鍵字的代碼
實現(xiàn)的功能是:標(biāo)題+標(biāo)題里除去非中文及中文標(biāo)點外的字符的、相鄰兩個字符的集合 傳說中這是采集文章處理keywords的最佳方式,呵呵,做了一個,用下試試2008-06-06