ASP截取中文

来源:百度知道 编辑:UC知道 时间:2024/06/08 16:00:05
Left(.oRS("Textfrom"), 120)
有没有某个函数只截取里面的文字不截取图的`
在文章里要是有图在开头的话要是显示内容`就会显示图`
<%
.OpenRS "SELECT TOP 8 * FROM [XB_article] WHERE [classid] = 63 and [Veryfy]=1 ORDER BY [ID] ", False
While Not .oRs.EOF
Function AspHtml(HtmlStr) ←我加在这里
Set re = New RegExp
re.Pattern ="<[^>]+>"
re.Global = True
re.IgnoreCase = False
re.MultiLine = True
AspHtml= re.Replace(HtmlStr,"")
End Function
提示:
Microsoft VBScript 编译器错误 错误 '800a03ea'
语法错误
/hy/qc/hotel.asp,行 64
Function AspHtml(HtmlStr)
^

可以分别过滤html代码和提取图片
____________________________________________________________
这两个是我写的过程,在该页的任何地方写上,然后修改
Left(.oRS("Textfrom"), 120) 为
Left(asphtml(.oRS("Textfrom")), 120)
这样就可以了

____________________________________________________________
晕,你不能写在循环里面啊,
这样吧,你给我发邮件nigouAT126点COM
____________________________________________________________
还好手边就有这个

过滤html代码

Function AspHtml(HtmlStr)
Set re = New RegExp
re.Pattern ="<[^>]+>"
re.Global = True
re.IgnoreCase = False
re.MultiLine = True
AspHtml= re.Replace(HtmlStr,"")
End Function

提取最后一张图片

Function GetImageURL(strText)
Dim RegEx, Matches, tmpStr
Set RegEx = New RegExp
RegEx.IgnoreCase =True
RegEx.Pattern = "<img.+?>"
RegEx.Global = True
Set Matches = RegEx.Execute(strText)
'strTex