|
|
|
7i24.Com不停为您服务
在中文系统下,vb和vbscript程序,len("中文abc")=5而不是7
而lenb("中文abc")=10,要获得正确获得正确的字节数,必须自
己写一个函数,as follows:
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
if c>255 then
t=t+1
end if
next
strLength=t
else
strLength=len(str)
end if
end function
|
|
|