function chkChar(str)
flag=false
enChar="a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"
onChar=split(enChar,",")
for i=0 to ubound(onChar)
if instr(str,onChar(i))<>0 then
flag=true
exit for
end if
next
chkChar=flag
end function
str="中华人民共和国a"
if chkChar(str) then
response.write "含有"
else
response.write "不含"
end if
’我手动测试通过了。
ceshi = "2a2b334dA"
ceshi2 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
response.write quzifu_config1(ceshi,ceshi2)
Function quzifu_config1(str,str2)
dim str1,dengzimu,linshi,enChar
str1 = str
dengzimu = ""
linshi = ""
enChar= str2 '"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"'大小写你转化下lcase ucase
'onChar=split(enChar,",")
for i=1 to len(str1)
linshi = instr(enChar,mid(str1,i,1))
if linshi > 0 then
if dengzimu = "" then
dengzimu = mid(str1,i,1)
else
dengzimu =
cstr(dengzimu) + cstr(mid(str1,i,1))
end if
str1 = replace(str1,mid(str1,1,i),mid(str1,1,i-1)&"`")
end if
next
quzifu_config1 = dengzimu
End Function
ReplaceChina("[^\u4e00-\u9fa5]",session("admin"),"")
'读取汉字
Function ReplaceChina(NeiRong,str,str1)
Dim CNregEx
set CNregEx = new RegExp
CNregEx.pattern=NeiRong
CNregEx.IgnoreCase=true
CNregEx.Global=true
ReplaceChina=CNregEx.replace(str,str1)
set CNregEx = nothing
End Function
[
本帖最后由 ysf0181 于 2013-1-6 15:47 编辑 ]