VB6 过滤HTML
VB6 过滤HTML
'过滤HTML字符替换为文字
VB6 过滤HTML
Private Function ReplaceToText(ByVal Html As String)
VB6 过滤HTML    
Dim i As Integer
VB6 过滤HTML    
Dim CurPosBefore As Long
VB6 过滤HTML    
Dim CurPosEnd As Long
VB6 过滤HTML    
Dim ReplaceTextTMP As String
VB6 过滤HTML    
Dim ReplaceText As String   '替换为该字符
VB6 过滤HTML
    
VB6 过滤HTML    
Do
VB6 过滤HTML        ReplaceText 
= ""
VB6 过滤HTML        CurPosBefore 
= InStr(1, Html, "<")
VB6 过滤HTML        
If CurPosBefore <> 0 Then
VB6 过滤HTML            
'found < text
VB6 过滤HTML
            CurPosEnd = InStr(CurPosBefore, Html, ">")
VB6 过滤HTML            
If CurPosEnd <> 0 Then
VB6 过滤HTML                
'found > text
VB6 过滤HTML
                ReplaceTextTMP = Mid(Html, CurPosBefore, CurPosEnd - CurPosBefore + 1)
VB6 过滤HTML                
If Len(ReplaceTextTMP) > 3 Then
VB6 过滤HTML                    
If Left(ReplaceTextTMP, 4= "<img" Then
VB6 过滤HTML                        ReplaceText 
= "[图象]"
VB6 过滤HTML                    
End If
VB6 过滤HTML                
End If
VB6 过滤HTML                Html 
= Replace(Html, ReplaceTextTMP, ReplaceText)
VB6 过滤HTML            
End If
VB6 过滤HTML        
End If
VB6 过滤HTML    
Loop While InStr(1, Html, "<"<> 0
VB6 过滤HTML    Html 
= Replace(Html, "&nbsp;"" ")
VB6 过滤HTML    ReplaceToText 
= Html
VB6 过滤HTML
End Function
VB6 过滤HTML

相关文章: