Re: Strip HTML
- From: State Troopers <StateTroopers@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 1 May 2006 08:50:02 -0700
replace < > with
& lt; and & gt;
was just for testing purposes.
"State Troopers" wrote:
Hey..
I want to remove everything BUT <br>
and I was replacing < with < just to test out ".< and .>"
Thanks.
"Douglas J Steele" wrote:
If all you want to do is remove the <BR>, you can use
strOutput = Replace(strOutput, "<BR>", " ")
BTW, why are you using Replace to change < to < and > to >? That does
absolutely nothing, other than taking machine cycles!
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"State Troopers" <StateTroopers@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:C77C1BDF-CCF1-4CFE-9D07-A0ABF9A106E4@xxxxxxxxxxxxxxxx
Hi there.used
I am currently working on a database/program that will take a certain html
page and store the strings on the page into a table, which will then be
in reports/queries.function
I have started with stripping the HTML tags off the page first. The
works very well.
But, my problem is that I am not sure how I would illiminate the function
from removing "<br>" .
Here is the function:
'Ensure that strHTML contains something
If Len(strHTML) = 0 Then
stripHTML = strHTML
Exit Function
End If
Dim arysplit, i, j, strOutput
arysplit = Split(strHTML, "<")
'Assuming strHTML is nonempty, we want to start iterating
'from the 2nd array postition
If Len(arysplit(0)) > 0 Then j = 1 Else j = 0
'Loop through each instance of the array
For i = j To UBound(arysplit)
'Do we find a matching > sign?
If InStr(arysplit(i), ">") Then
'If so, snip out all the text between the start of the string
'and the > sign
'IF statement to NOT remove <br> tags.
arysplit(i) = Mid(arysplit(i), InStr(arysplit(i), ">") + 1)
Else
'Ah, the < was was nonmatching
arysplit(i) = "<" & arysplit(i)
End If
Next
'Rejoin the array into a single string
strOutput = Join(arysplit, "")
'Snip out the first <
strOutput = Mid(strOutput, 2 - j)
'Convert < and > to < and >
strOutput = Replace(strOutput, ">", ">")
strOutput = Replace(strOutput, "<", "<")
strOutput = Replace(strOutput, "-", "<")
stripHTML = strOutput
Thanks.
-State
- References:
- Strip HTML
- From: State Troopers
- Re: Strip HTML
- From: Douglas J Steele
- Re: Strip HTML
- From: State Troopers
- Strip HTML
- Prev by Date: Re: Strip HTML
- Next by Date: Label will not display NEW records frm another (bound) form.
- Previous by thread: Re: Strip HTML
- Next by thread: Re: Strip HTML
- Index(es):
Relevant Pages
|