function strLength(str)
dim WINNT_CHINESE
WINNT_CHINESE=(len("飞鸟")=2)
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
rem asc对中文字符求出来的值可能为负数,
rem 加上65536就可求出它的无符号数值
rem -1在机器内是用补码表示的0xffff,
rem 其无符号值为65535,65535=-1+65536
rem 其他负数依次类推。
if c>255 then
t=t+1
end if
next
strLength=t
else
strLength=len(str)
end if
end function copyright aspcn.com
dim WINNT_CHINESE
WINNT_CHINESE=(len("飞鸟")=2)
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
rem asc对中文字符求出来的值可能为负数,
rem 加上65536就可求出它的无符号数值
rem -1在机器内是用补码表示的0xffff,
rem 其无符号值为65535,65535=-1+65536
rem 其他负数依次类推。
if c>255 then
t=t+1
end if
next
strLength=t
else
strLength=len(str)
end if
end function copyright aspcn.com
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货