截字符串 去除HTML标记

时间:2023-07-29 17:01:08 

<%
'**************************************************
'函数名:gotTopic
'作 用:截字符串,汉字一个算两个字符,英文算一个字符
'参 数:str ----原字符串
' strlen ----截取长度
'返回值:截取后的字符串
'**************************************************
function gotTopic(str,strlen)
if str="" then
gotTopic=""
exit function
end if
dim l,t,c, i
str=replace(replace(replace(replace(str," "," "),""",chr(34)),">",">"),"<","<")
str=replace(str,"?","")
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
gotTopic=replace(replace(replace(replace(gotTopic," "," "),chr(34),"""),">",">"),"<","<")
end function
'=========================================================
'函数:RemoveHTML(strHTML)
'功能:去除HTML标记
'参数:strHTML --要去除HTML标记的字符串
'=========================================================
Function RemoveHTML(strHTML)
Dim objRegExp, Match, Matches
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
'取闭合的<>
objRegExp.Pattern = "<.+?>"
'进行匹配
Set Matches = objRegExp.Execute(strHTML)
' 遍历匹配集合,并替换掉匹配的项目
For Each Match in Matches
strHtml=Replace(strHTML,Match.Value,"")
Next
RemoveHTML=strHTML
Set objRegExp = Nothing
set Matches=nothing
End Function
%>

标签:截字符串,去除HTML标记
0
投稿

猜你喜欢

  • 刷新页面的几种方法小结(JS,ASP.NET)

    2024-05-28 15:37:33
  • Python高级特性之闭包与装饰器实例详解

    2021-09-19 03:17:25
  • WebStorm 遇到的问题总结

    2023-08-31 23:30:00
  • Python OpenCV实现姿态识别的详细代码

    2023-05-27 23:42:31
  • python使用Plotly绘图工具绘制散点图、线形图

    2022-06-24 08:11:50
  • python中使用asyncio实现异步IO实例分析

    2021-02-06 10:02:50
  • Python Pandas 如何shuffle(打乱)数据

    2023-04-22 23:17:16
  • MySQL基础教程之事务异常情况

    2024-01-15 06:12:20
  • python使用rsa非对称加密过程解析

    2021-06-15 00:14:51
  • 客户体验

    2008-12-11 13:58:00
  • Python写的Tkinter程序屏幕居中方法

    2022-08-03 17:53:07
  • 使用c#构造date数据类型

    2024-01-15 22:19:15
  • JavaScript性能优化小技巧,创建文档碎片

    2010-03-31 18:27:00
  • Python OpenCV实战之与机器学习的碰撞

    2022-04-30 17:17:21
  • vue3配置全局参数(挂载全局方法)以及组件的使用

    2023-07-02 16:45:46
  • 将数据插入到MySQL表中的详细教程

    2024-01-12 22:01:21
  • 基于信息排序的信息理解

    2008-05-16 10:37:00
  • python 实现检验33品种数据是否是正态分布

    2022-09-25 19:57:55
  • 5分钟了解MySQL5.7中union all用法的黑科技

    2024-01-22 16:53:00
  • ASP实现GB2312转UTF-8函数

    2009-02-26 13:08:00
  • asp之家 网络编程 m.aspxhome.com