首页 >> 网页技术 > asp技术 >> 详细内容
网页技术
 
asp技术 >> 正文
显示指定字数的标题函数
日期:2017/6/15 
function gotTopic(str,strlen)
 dim l,t,c, i
 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
 gotTopic=left(str,i)&"..."
 exit for
 else
 gotTopic=str
 end if
 next
end function