HTML Strip function

BlitzMax Forums/BlitzMax Programming/HTML Strip function

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Here you go - this is a very simple implementation though, and it does not strip comments or ignore tag characters in strings.

Print stripTags("<html><head><title>This Is A title</title></head><body>Whatever</body></html>")

Function stripTags:String(text:String)
	
	Local tagDepth
	Local output:String
	
	For Local i=0 Until text.length
		If text[i]=Asc("<") tagDepth :+ 1
		
		
		If tagDepth=0
			output = output + Chr(text[i])
		End If
		
		If text[i]=Asc(">") tagDepth :- 1
	Next
	
	Return output
	
End Function