VB.NET Remove HTML
Page 1 of 1
VB.NET Remove HTML
Imports System.Text.RegularExpressions
Module Module1
Sub Main()
' Input.
Dim html As String = "<p>There was a <b>.NET</b> programmer " +
"and he stripped the <i>HTML</i> tags.</p>"
' Call Function.
Dim tagless As String = StripTags(html)
' Write.
Console.WriteLine(tagless)
End Sub
''' <summary>
''' Strip HTML tags.
''' </summary>
Function StripTags(ByVal html As String) As String
' Remove HTML tags.
Return Regex.Replace(html, "<.*?>", "")
End Function
End Module
Output
There was a .NET programmer and he stripped the HTML tags.
Module Module1
Sub Main()
' Input.
Dim html As String = "<p>There was a <b>.NET</b> programmer " +
"and he stripped the <i>HTML</i> tags.</p>"
' Call Function.
Dim tagless As String = StripTags(html)
' Write.
Console.WriteLine(tagless)
End Sub
''' <summary>
''' Strip HTML tags.
''' </summary>
Function StripTags(ByVal html As String) As String
' Remove HTML tags.
Return Regex.Replace(html, "<.*?>", "")
End Function
End Module
Output
There was a .NET programmer and he stripped the HTML tags.
giovhz- Newbie
- Posts : 41
Join date : 2013-03-09
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|