判断文章中文字符数量
2000-11-12 10:13:17 来源:WEB开发网核心提示:dim WINNT_CHINESE WINNT_CHINESE = (len("论坛")=2) function strLength(str) ON ERROR RESUME NEXT if WINNT_CHINESE thendim l,t,cdim il=len(str)t=lfor i=1 t
dim WINNT_CHINESE
WINNT_CHINESE = (len("论坛")=2)
function strLength(str)
ON ERROR RESUME NEXT
if WINNT_CHINESE then
dim l,t,c
dim i
l=len(str)
t=l
for i=1 to l
c=asc(mid(str,i,1))
if c<0 then c=c+65536
if c>255 then
t=t+1
end if
next
strLength=t
else
strLength=len(str)
end if
if err.number<>0 then err.clear
end function
WINNT_CHINESE = (len("论坛")=2)
function strLength(str)
ON ERROR RESUME NEXT
if WINNT_CHINESE then
dim l,t,c
dim i
l=len(str)
t=l
for i=1 to l
c=asc(mid(str,i,1))
if c<0 then c=c+65536
if c>255 then
t=t+1
end if
next
strLength=t
else
strLength=len(str)
end if
if err.number<>0 then err.clear
end function
更多精彩
赞助商链接