逐个字符查ascii码 for i = 1 to len(string ) aa=mid(string,1,1) if asc(aa)<0 or aa>256 then msgbox "有汉字" end if
sorry.忘了next for i = 1 to len(string ) aa=mid(string,1,1) if asc(aa)<0 or aa>256 then msgbox "有汉字" end if next
cccmx() 的代码好像错了耶 Function IsChinese(Str As String) as boolean dim pos as integer,length as integer length=len(str) ischinese=false for pos=1 to length if asc(mid(str,pos,1))<0 then IsChinese=true:exit function next end function
逐个字符查ascii码,如果<0,是中文
如:Asc("如")=-14105
Asc("a")=97
for i = 1 to len(string )
aa=mid(string,1,1)
if asc(aa)<0 or aa>256 then
msgbox "有汉字"
end if
for i = 1 to len(string )
aa=mid(string,1,1)
if asc(aa)<0 or aa>256 then
msgbox "有汉字"
end if
next
Function IsChinese(Str As String) as boolean
dim pos as integer,length as integer
length=len(str)
ischinese=false
for pos=1 to length
if asc(mid(str,pos,1))<0 then IsChinese=true:exit function
next
end function