dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: VB4,VB5,VB6,VBS
Expertise: Intermediate
Jan 27, 2001

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


HTMLDecode - Convert an HTML string to a plain text

' Decode an HTML string to a regular ANSI string
'
' it strips down all special HTML sequences (eg "<")
' however, it doesn't strip HTML tags

Function HTMLDecode(ByVal html As String) As String
    Dim i As Long
    
    HTMLDecode = html
    
    Do
        ' search the next ampersand, exit if no more
        i = InStr(i + 1, HTMLDecode, "&")
        If i = 0 Then Exit Do

        If StrComp(Mid$(HTMLDecode, i, 6), " ", vbTextCompare) = 0 Then
           HTMLDecode = Left$(HTMLDecode, i - 1) & " " & Mid$(HTMLDecode, i + 6)
        ElseIf StrComp(Mid$(HTMLDecode, i, 6), """, vbTextCompare) = 0 Then
            HTMLDecode = Left$(HTMLDecode, i - 1) & """" & Mid$(HTMLDecode, _
                i + 6)
        ElseIf StrComp(Mid$(HTMLDecode, i, 5), "&", vbTextCompare) = 0 Then
            HTMLDecode = Left$(HTMLDecode, i - 1) & "&" & Mid$(HTMLDecode, _
                i + 5)
        ElseIf StrComp(Mid$(HTMLDecode, i, 4), "<", vbTextCompare) = 0 Then
            HTMLDecode = Left$(HTMLDecode, i - 1) & "<" & Mid$(HTMLDecode, _
                i + 4)
        ElseIf StrComp(Mid$(HTMLDecode, i, 4), "&gt;", vbTextCompare) = 0 Then
            HTMLDecode = Left$(HTMLDecode, i - 1) & ">" & Mid$(HTMLDecode, _
                i + 4)
        End If
    Loop
End Function
Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date