Home » Programming » C# » How to extract text content from tags in VB.Net

How to extract text content from tags in VB.Net

With this simple vb.net function You are able to extract content from HTML tags, useful and smart

Max 🙂

[sourcecode language=”vb”] Public Function GetTagContent(ByRef html As String, ByVal start_tag As String, ByVal end_tag As String) As String
Dim s As String = ""
Dim content() As String = html.Split(start_tag)
If content.Count > 1 Then
Dim parts() As String = content(1).Split(end_tag)
If parts.Count > 1 Then
s = parts(0)
End If
End If
Return s
End Function
[/sourcecode]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.