Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

HTMLDecode - Convert an HTML string to a plain text

Total Hit ( 3441)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


Click here to copy the following block
' 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


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.