有个完整的截取自定义函数 和去html函数 拿来用就可以了
[html]
'去掉html标记
public function replacehtml(textstr)
dim str,re
str=textstr
set re=new regexp
re.ignorecase =true
re.global=true
re.pattern="]*)>"
str=re.replace(str, "")
set re=nothing
replacehtml=str
end function
'用省略号格式化数据标题(兼容中文字)
function cutstr(str,strlen,endstr)
dim cvst:cvst=str
if cvst="" then
cutstr=""
exit function
end if
dim l,t,c
l=len(cvst)
t=0
for i=1 to l
c=abs(asc(mid(cvst,i,1)))
if c>255 then
t=t+2
else t=t+1
end if
if t>=strlen then
cutstr=left(cvst,i)&endstr
exit for
else cutstr=cvst
end if
next
cutstr=replace(cutstr,chr(10),"")
cutstr=replace(cutstr,chr(0),"")
end function
%>
[/html]
自定义函数的和内部函数使用方法一样
截取数据库content内容如下
[html]
[/html]