求一个去掉所有html代码的函数。

noon808 2003-09-25 10:25:17
就是将所有的html代码都去掉,只留下文本文件。不带有任何格式。
...全文
37 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
mzcih 2003-09-25
  • 打赏
  • 举报
回复
好东东。我COPY。
taogx 2003-09-25
  • 打赏
  • 举报
回复
Function stripHTML2(strtext)
dim arysplit,i,j, strOutput
arysplit=split(strtext,"<")

if len(arysplit(0))>0 then j=1 else j=0

for i=j to ubound(arysplit)
if instr(arysplit(i),">") then
arysplit(i)=mid(arysplit(i),instr(arysplit(i),">")+1)
else
arysplit(i)="<" & arysplit(i)
end if
next

strOutput = join(arysplit, "")
strOutput = mid(strOutput, 2-j)
strOutput = replace(strOutput,">",">")
strOutput = replace(strOutput,"<","<")

stripHTML = strOutput
End Function

taogx 2003-09-25
  • 打赏
  • 举报
回复
Function stripHTML(strHTML)
'Strips the HTML tags from strHTML

Dim objRegExp, strOutput
Set objRegExp = New Regexp

objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<.+?>"

'Replace all HTML tag matches with the empty string
strOutput = objRegExp.Replace(strHTML, "")

'Replace all < and > with < and >
strOutput = Replace(strOutput, "<", "<")
strOutput = Replace(strOutput, ">", ">")

stripHTML = strOutput 'Return the value of strOutput

Set objRegExp = Nothing
End Function

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧