百度首页 | 百度空间
 
查看文章
 
转换HTML代码,让代码也显示在页面上;检测是否有效的数字;去掉html标签,去掉换行,代码过滤完
2008/05/13 11:54

检测是否有效的数字-----------------
Function IsInteger(Para)
IsInteger=False
If Not (IsNull(Para) Or Trim(Para)="" Or Not IsNumeric(Para)) Then
     IsInteger=True
End If
End Function

'转换HTML代码-----------------------
Function HTMLDecode(reString)
Dim Str:Str=reString
If Not IsNull(Str) Then
     Str = Replace(Str, "&", "&")
     Str = Replace(Str, ">", ">")
     Str = Replace(Str, "&lt;", "<")
     Str = Replace(Str, "&nbsp;", CHR(32))
        Str = Replace(Str, "&nbsp;", CHR(9))
     Str = Replace(Str, "&#160;&#160;&#160;&#160;", CHR(9))
     Str = Replace(Str, "&quot;", CHR(34))
     Str = Replace(Str, "&#39;", CHR(39))
     Str = Replace(Str, "", CHR(13))
     Str = Replace(Str, "<br>", CHR(10))
     HTMLDecode = Str
End If
End Function

'去掉html标签,去掉换行
    Function     NoHtml(strText)   
    Dim     regEx   
    Set     regEx     =     New     RegExp   
    regEx.Global     =     True   
    regEx.IgnoreCase     =     True   
    regEx.Pattern     =     "\n"   
    strText     =     regEx.Replace(strText,"")   
    regEx.Pattern     =     "\r"   
    strText     =     regEx.Replace(strText,"")   
    regEx.Pattern     =     "<script(.*?)>(.*?)<\/script>"   
    strText     =     regEx.Replace(strText,"")   
    regEx.Pattern     =     "<(.+?)>"   
    strText     =     regEx.Replace(strText,"")
    NoHtml     =     strText
    End     Function


类别:asp技术文章 | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码:
 

     

©2008 Baidu