StripHTML Function:
Removes HTML code from a string.
Description:
The StripHTML function removes all HTML code from a string.
Syntax:
string = StripHTML(string)
Example:
<%
dim a
a = a & "<HTML>" & vbCrLf a = a & "<HEAD>" & vbCrLf a = a & "<TITLE>Now place</TITLE>" & vbCrLf a = a & "</HEAD>" & vbCrLf a = a & "<BODY>" & vbCrLf a = a & "some body text here!!!" & vbCrLf a = a & "<A HREF=""./johnson.asp"">some link</A>" & vbCrLf a = a & "</BODY>" & vbCrLf a = a & "</HTML>" & vbCrLf
response.write StripHTML(a)
'--- returns: '--- "Now placesome body text here!!!some link"
%>
ASP Source Code:
<%
Private Function StripHTML(byVal string) Dim lngStart, lngEnd, strHTML string = Replace(string, vbTab, "") string = Replace(string, vbCrLf, "") string = Trim(string) Do lngStart = Instr(string, "<") lngEnd = InStr(string, ">") If lngStart > 0 Or lngEnd > 0 Then strHTML = Mid(string, lngStart, lngEnd - lngStart + 1) string = Trim(Replace(string, strHTML, "")) End if Loop until Not Instr(string, "<") AND Not Instr(string, ">") If Instr(string, "<") Then string = StripHTML(Trim(string)) End if StripHTML = Trim( string ) End Function
%>
|