Parsing HTML Text - Removing Unneeded Tags (More Classic ASP)

This little function was a nifty way to remove unneeded HTML tags from a string. Used this to clean up "screenscrapes" of reports generated in HTML before parsing the content.

' * ==================================================================================================

Function RipTags(sHTML,sTagType)

	Dim iStart, sFront, sBack
	Do While inStr(1,sHTML,"<" & sTagType,1) > 0
		iStart = instr(1,sHTML,"<" & sTagType,1)
		If iStart > 0 Then
			sFront = left(sHTML,iStart-1)
	
			iStart = instr(iStart,sHTML,">",1)
			sBack = right(sHTML,len(sHTML)-iStart)
	
			sHTML = sFront & sBack
		End If
	
		iStart = instr(1,sHTML,"",1)
		If iStart > 0 Then 
			sFront = left(sHTML,iStart-1)
			iStart = instr(iStart,sHTML,">",1)
			sBack = right(sHTML,len(sHTML)-iStart)
			sHTML = sFront & sBack
		End If
	Loop
	RipTags = sHTML
	
End Function
keywords: 

AuthorInfo

Joe is a User Experience Engineer, Front End Specialist and Application Developer for Bridgeway Software, Inc and part-time consultant for NGO and non-profit organizations in the Houston area. Joe is also a part-time Portrait Photographer at MEDIA.24Moves.com and organizer of the HoustonPhotowalks.com photography club. He and his wife Marty run the AutismHouston.com Support and Playdate group.

-

@ext237

-

@drupaltips

-

Flickr

-

LinkedIn

-

Ports

-

Contact


Fatal error: Class CToolsCssCache contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (DrupalCacheInterface::__construct) in /home/content/e/x/t/ext237/html/modules/ctools/includes/css-cache.inc on line 52