现在一段英文简介太长,我想截取一部分,现用 <%=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, " ", " "),Chr(34), "" "), "> ", "> "), " < ", "< ")
end function%>
在要截取的地方用
<%=GotTopic(rs( "title "),100)%>