Read between strings
Posted: Mon May 23, 2011 11:18 am
I need help reading string between strings xD for example "</xx>TEXT<xx/>
i want to read the "TEXT" between these two
i want to read the "TEXT" between these two

Sharing, Teaching and Supporting coders of all ages and levels since 2009
https://www.codenstuff.com/forum/
Private Sub DisplayMetaDescription()
If (WebBrowser1.Document IsNot Nothing) Then
Dim Elems As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("META")
For Each elem As HtmlElement In Elems
Dim NameStr As String = elem.GetAttribute("name")
If ((NameStr IsNot Nothing) And (NameStr.Length <> 0)) Then
If NameStr.ToLower().Equals("description") Then
Dim ContentStr As String = elem.GetAttribute("content")
MessageBox.Show("Document: " & WebBrowser1.Url.ToString() & vbCrLf & "Description: " & ContentStr)
End If
End If
Next
End If
End Sub
Private Function GetTableRowCount(ByVal TableID As String) As Integer
Dim Count As Integer = 0
If (WebBrowser1.Document IsNot Nothing) Then
Dim TableElem As HtmlElement = WebBrowser1.Document.GetElementById(TableID)
If (TableElem IsNot Nothing) Then
For Each RowElem As HtmlElement In TableElem.GetElementsByTagName("TR")
Count = Count + 1
Next
Else
Throw (New ArgumentException("No TABLE with an ID of " & TableID & " exists."))
End If
End If
GetTableRowCount = Count
End Function
Dim input As String = "</xx>TEXT<xx/>"
Dim text As String = input.Remove(0, input.IndexOf(">"c) + 1)
text = text.Remove(text.IndexOf("<"c))
MsgBox(text)