1)函数:rowscode()—–每行显示n个字母,自动换行
function rowscode(str,n)
if len(str)<=n/2 then
rowscode=str
else
dim tstr
dim l,t,c
dim i
l=len(str)
tstr=""
t=0
for i=1 to l
c=asc(mid(str,i,1))
if c<0 then c=c+65536
if c>255 then
t=t+2
else
t=t+1
end if
tstr=tstr&(mid(str,i,1))
if t>n then
tstr=tstr&"<br>"
t=0
end if
next
rowscode= tstr
end if
end function
2)函数:lefttrue()—–如果字符串str的长度大于n,则显示左边的n个字符
function lefttrue(str,n)
if len(str)<=n/2 then
lefttrue=str
else
dim tstr
dim l,t,c
dim i
l=len(str)
tstr=""
t=0
for i=1 to l
c=asc(mid(str,i,1))
if c<0 then c=c+65536
if c>255 then
t=t+2
else
t=t+1
end if
if t>n then exit for
tstr=tstr&(mid(str,i,1))
next
lefttrue = tstr & "…"
end if
end function
