[RESOLVED] LastIndexOf count problem?
I have a web page source and want to extract some info. I have this:
Code:
Dim strText As String, intPos1 As Integer = 0, intPos2 As Integer = 0
strText = rtBox1.Text
While intPos2 < strText.Length
intPos1 = strText.IndexOf("<h>", intPos1)
intPos2 = strText.LastIndexOf("</h>", intPos1)
MsgBox(intPos1 & " " & intPos2)
'MsgBox(Mid(strText, intPos1 + 3, intPos2), MsgBoxStyle.Information)
If intPos2 = -1 Then Exit While
intPos2 = (intPos2 + 1)
End While
The problem is this: intPos2 = strText.LastIndexOf("</h>", intPos1)
if I remove the ", intPos1" from LastIndexOf it works but I want to continue in the text but if I place a Integer after "("</h>", X)" I get -1 as result = no match?? Thanks for clearing this out
Re: LastIndexOf count problem?
LastIndexOf will start at your intPos1 and count backwards toward the beginning of the string. Is that what you are looking for?
Re: LastIndexOf count problem?
Ahh see my mistake now when I got some sleep thanks for the help!