<%
dim str
str=len(rs("softName"))
if str>10 then
response.Write left(rs("softName"),10)&"…"
else response.Write rs("softName")
end if
%>
谢谢各位啦
...全文
1467打赏收藏
大家帮我改一下这个函数
功能是做一个排行榜,如果标题长度大于10就取子串,后面加… 我写的这个怎么取不准阿,似乎对中文支持很不好,而且都加…,不论是几个汉字 10 then response.Write left(rs("softName"),10)&"…" else response.Write rs("softName") end if %> 谢谢各位啦
Function checklen(str,strlen)
if len(str)>0 then
dim l,t,c
l=len(str)
t=0
for i=1 to l
c=Abs(Asc(Mid(str,i,1)))
if c>255 then
t=t+2
else
t=t+1
end if
if t>=strlen then
checklen="<font title='"&str&"' >"&left(str,strlen)& "...</font>"
else
checklen=str
end if
next
checklen=replace(checklen,chr(10),"")
end if
end Function