Search Tools Links Login

Remove HTML


The trimHTML(string) function removes any html tags that are embedded in the string.

Original Author: Andrew Forbes

Inputs

a string

Assumptions

Useage:
x = trimHTML("a string with html")
which produces: "a string with html"

Returns

the string, with all html elements removed.

Side Affects

none

Code

<%
function TrimHTML(strHTML)
dim iteration
iteration=0
do until instr(1,strHTML,"<")=0 and instr(1,strHTML,">")=0
b=instr(1,strHTML,"<")
if b>0 then
c = instr(b+1,strHTML,">")
if c>0 then
retVal = mid(strHTML,b,c-(b-1))
strHTML=Replace(strHTML,retVal,"")
end if
end if
iteration = iteration + 1
if iteration=1000 then exit do
loop
TrimHTML= strHTML
End function
dim str
str="952-917-0489"
%>
Original text with html: <% =str %>

text with html removed: <% =TrimHTML(str) %>

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 77 times

Categories

ASP/ HTML

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.