我的库是ACCESS ,库中某字段宽度50 ,但在页面中我为了防止出错(要输汉字)限定宽度是25 。但我发现字母也只能输25个 ,这是怎么回事。
---------------------------------------------------------------
ASPCN的len函数:
FUNCTION cnlen(str) '我写的
length=0
for i=1 to len(str)
if asc(mid(str,i,1))<0 then length=length+2 else length=length+1
next
cnlen=length
end function
function strLength(str) '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