计算字符串的长度,以Byte为单位,每个汉字为:2,英文为:1
可用以下函数计算出字符串的实际长度:
function strlen(str)
dim p_len
p_len=0
strlen=0
if trim(str)<>"" then
p_len=len(trim(str))
for xx=1 to p_len
if asc(mid(str,xx,1))<0 then
strlen=int(strlen) + 2
else
strlen=int(strlen) + 1
end if
next
end if
end function |
|