Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 20th, 2004, 12:11 PM
Registered User
 
Join Date: Feb 2004
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Strip HTML with ASP Question

Hello,

I am trying to strip all the html tags, including   as well as all end of line characters so that whats left is all on one line. I have got it working for just the html tags but cant for the life of me get it to clean the   or end of line characters. Here's what I have so far. Any suggestions?

Function StripHTMLTag(ByVal sText)
   StripHTMLTag = ""
   fFound = False
   Do While InStr(sText, "<")
      fFound = True
      StripHTMLTag = StripHTMLTag & " " & Left(sText, InStr(sText, "<")-1)
      sText = MID(sText, InStr(sText, ">") + 1)
   Loop
   Do While InStr(sText, "&nbsp;")
      fFound = True
      StripHTMLTag = StripHTMLTag & " " & Left(sText, InStr(sText, "&nbsp;")-1)
      sText = MID(sText, InStr(sText, "&nbsp;") + 1)
   Loop
   StripHTMLTag = StripHTMLTag & sText
   If Not fFound Then StripHTMLTag = sText
End Function

Reply With Quote
  #2 (permalink)  
Old January 17th, 2005, 08:15 AM
Registered User
 
Join Date: Jan 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here I think you have the response to your question, i hope that helps you. You were very near.
Function StripHTMLTag(ByVal sText)
   StripHTMLTag = ""
   fFound = False
   Do While InStr(sText, "<")
      fFound = True
      StripHTMLTag = StripHTMLTag & " " & Left(sText, InStr(sText, "<")-1)
      sText = MID(sText, InStr(sText, ">") + 1)
   Loop
   sText = StripHTMLTag & sText
       StripHTMLTag = ""
   Do While InStr(sText, "†")
      fFound = True
      StripHTMLTag = StripHTMLTag & " " & Left(sText, InStr(sText, "†")-1)
      sText = MID(sText, InStr(sText, "†") + 6)
   Loop
   StripHTMLTag = StripHTMLTag & sText
   If Not fFound Then StripHTMLTag = sText
End Function

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
strip html tags with xslt smiter XSLT 4 June 19th, 2012 09:34 AM
Two HTML files Question bonekrusher XSLT 2 August 10th, 2006 03:04 PM
strip html from spider script results mcalcagno PHP How-To 0 January 31st, 2005 09:14 AM
very simple HTML question nusrati HTML Code Clinic 11 July 13th, 2004 08:58 PM
strip html tags & PHP trangd Beginning PHP 6 October 21st, 2003 11:28 AM



All times are GMT -4. The time now is 11:41 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.