' ****************************************************** ' ** AUTHOR: Tony Lorentzen, tony@lorentzen.com ** ' ** DESCRIPTION: Removes HTML tags from text ** ' ****************************************************** function html2Text(strValue) On Error Resume Next Dim Str, Position, Position2, i Str=strValue do while instr(Str, "<") > 0 or loopCount > 100 loopCount = loopCount+1 Position = Instr(Str, "<") Position2 = Instr(Position, Str, ">")+1 if Position2 < Position then Position2 = Position+1 'Response.write Position & "," & Position2 & "<BR>" strValue = Mid(Str,Position,Position2-Position)
'choenes june 2003 'added support for xhtml formatting (FCKeditor has this option) if ucase(strValue) = "<BR>" or ucase(strValue) = "<BR />" or ucase(strValue) = "<BR/>" then Str = replace(Str, StrValue, vbCrLf) elseif ucase(strValue) = "</P>" or ucase(strValue) = "<P />" or ucase(strValue) = "<P/>" then Str = replace(Str, StrValue, vbCrLf & vbCrLf ) else Str = replace(Str, strValue, "") end if
RE: HTML 2 text
RE: HTML 2 text
RE: HTML 2 text
' ** AUTHOR: Tony Lorentzen, tony@lorentzen.com **
' ** DESCRIPTION: Removes HTML tags from text **
' ******************************************************
function html2Text(strValue)
On Error Resume Next
Dim Str, Position, Position2, i
Str=strValue
do while instr(Str, "<") > 0 or loopCount > 100
loopCount = loopCount+1
Position = Instr(Str, "<")
Position2 = Instr(Position, Str, ">")+1
if Position2 < Position then Position2 = Position+1
'Response.write Position & "," & Position2 & "<BR>"
strValue = Mid(Str,Position,Position2-Position)
'choenes june 2003
'added support for xhtml formatting (FCKeditor has this option)
if ucase(strValue) = "<BR>" or ucase(strValue) = "<BR />" or ucase(strValue) = "<BR/>" then
Str = replace(Str, StrValue, vbCrLf)
elseif ucase(strValue) = "</P>" or ucase(strValue) = "<P />" or ucase(strValue) = "<P/>" then
Str = replace(Str, StrValue, vbCrLf & vbCrLf )
else
Str = replace(Str, strValue, "")
end if
if Err.Number > 0 then
Exit Do
end if
loop
html2Text = HtmlDecode(Str)
end function