Read between strings
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
4 posts
Page 1 of 1
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

WebBrowser1.Document.getElementByTagName
Code: Select all
WebBrowser1.Document.getElementById
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
Code: Select all
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
It isn't clear how we would use the code above to get a substring.
You could use this:
You could use this:
Code: Select all
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)
4 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023