Wednesday, March 13, 2013

ASP.NET/VB.NET - Remove HTML Markup to Display As Plain Text


''' <summary>
    ''' function will remove any text that shows up between the less than and greater than symbols to display HTML as text in a control such as a listbox
    ''' </summary>
    ''' <param name="strText"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Private Function RemoveHTML(strText) As String
        Try
            Return Regex.Replace(strText, "<[^>]*>", "")
        Catch ex As Exception
            Throw ex
        End Try
    End Function

No comments:

Post a Comment