Results 1 to 2 of 2

Thread: remove tags from html file

  1. #1

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Question

    Hi

    How I remove Tags from file with extension html, via VB or Stored Procedure

    Thank You very much

  2. #2
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722
    Try this:

    Code:
    Private Function Tagless(ByVal Text As String) As String
        Dim i As Integer
        Dim bInTag As Boolean
        Dim strTmpStr As String
    
        bInTag = False
        For i = 1 to Len(Text)
            If Not bInTag Then
                If Mid(Text, i, 1) <> "<" Then
                    strTmpStr = strTmpStr & Mid(Text, i, 1)
                Else
                    bInTag = True
                End If
            Else
                If Mid(Text, i, 1) = ">" Then
                    bInTag = False
                End If
            End If
        Next
    
        TagLess = strTmpStr
    End Function
    
    Private Sub Form_Load()
        Dim strHTML As String
        strHTML = "<HTML>" & _
                  "<HEAD>" & _
                  "<TITLE>Test Page</TITLE>" & _
                  "</HEAD>" & _
                  "<BODY>" & _
                  "Hello World!" & _
                  "</BODY>" & _
                  "</HTML>"
        MsgBox Tagless(strHTML)
    End Sub
    Should give you a Messagebox with "Test PageHello World!" in it.

    r0ach™
    Don't forget to rate the post

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width