StripHTML function

If you know the meaning of Strip word you will know what does it do.  just kidding 🙂

The StripHTML function removes all HTML code from a string.
Syntax:
string = StripHTML(string)
Example Usage:
<%
dim a

a = a & “<HTML>” & vbCrLf
a = a & “<HEAD>” & vbCrLf
a = a & “<TITLE>Rana’s Blog</TITLE>” & vbCrLf
a = a & “</HEAD>” & vbCrLf
a = a & “<BODY>” & vbCrLf
a = a & “-Code Project!!!” & vbCrLf
a = a & “<A href=”” mce_href=””./Rana.asp””></A>” & vbCrLf
a = a & “</BODY>” & vbCrLf
a = a & “</HTML>” & vbCrLf

response.write StripHTML(a)

%>

Output
Rana’s Blog – Code Project

One of my reader asked me how to do in ASP.NET 

In ASP.NET you can strip the HTML using Regex

Dim StrStripped As String

StrStripped = System.Text.RegularExpressions.Regex.Replace(“Input as String”, “Pattern like (.|\n)*?”, String.Empty)

Advertisements