Advertisement
4_2005-2006 Internet/ HTML #171539

HTML toText

This little piece of code will strip all HTML tags from a web page. What your left with is pure text. I've seen a few approaches, one which took up 500 lines of code. And some guy is selling an HTML stripper for $250. Rediculous. This is my first post here. I just wanted to share and save someone some time.

AI

Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Zdrojový kód
original-source
Public Function HTML2Text(ByVal HTML As String) As String
Dim X As Long
Dim B As String
Dim String1 As String
Dim Counter As Long
X = 1
B$ = Mid(HTML, X, 1)
While Len(B$) = 1
B$ = Mid(HTML, X, 1)
If B$ = "<" Then Counter = Counter + 1
If Counter = 0 Then String1$ = String1$ + B$
If B$ = ">" And Counter <> 0 Then Counter = Counter - 1
X = X + 1
Wend
HTML2Text = String1
End Function
Původní komentáře (3)
Obnoveno z Wayback Machine