I have html code extracted from a search query on the net as a string passed to listextract. In that code bracketed by <H3>'s are the names I want to put into a list box. Also in that code is a lot of extraneous stuff I don't want.
So I can extract out the first <h3> to </h3> OK but then I can't get the next ones. I used a standard FOR NEXT loop in the main SUB but it only ever got me the first field and then repeated it for the length of listextract.
Here is the attached program, I was going to give it to the community when I finished it anyway
Anyone know an easier way?
edit: fixed attachment to show how it works (or doesn't)
So I can extract out the first <h3> to </h3> OK but then I can't get the next ones. I used a standard FOR NEXT loop in the main SUB but it only ever got me the first field and then repeated it for the length of listextract.
Here is the attached program, I was going to give it to the community when I finished it anyway
Anyone know an easier way?
B4X:
Try
For i=0 To listextract.Length - 1
result = listextract.SubString(listextract.IndexOf("<h3>"))
result = result.SubString2(4, result.IndexOf("</h3>"))
'cut it out again to get to the text
Dim resultsword As String
resultsword = result.SubString(result.IndexOf(">"))
resultsword = resultsword.SubString2(1, resultsword.IndexOf("<"))
'put it in the list
lvsearch.AddSingleLine( i & " " & resultsword)
Next
Catch
ToastMessageShow("end",False)
End Try
edit: fixed attachment to show how it works (or doesn't)
Last edited: