日期:2014-05-17  浏览次数:20924 次

截取英文问题!
现在一段英文简介太长,我想截取一部分,现用 <%=left(rs( "content "),200)%> ,这样会把一个英文单词截成一半,

顺便问一下,中英文混合文本的截取??

------解决方案--------------------
<%Function GotTopic(Str,StrLen)
Dim l,t,c, i
l=len(str)
t=0
strlen=Clng(strLen)
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
GotTopic = Replace(Replace(Replace(Replace(GotTopic, " ", "&nbsp; "),Chr(34), "&quot; "), "> ", "&gt; "), " < ", "&lt; ")
end function%>
在要截取的地方用
<%=GotTopic(rs( "title "),100)%>