Advertisement
4_2005-2006 VB function enhancement #150314

Strip HTML

Strip HTML from a string with this function. That basically explains it's all!!

AI

ИИ-обзор: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Исходный код
original-source
Public Function StripHTML(sHTML As String) As String
Dim sTemp As String, lSpot1 As Long, lSpot2 As Long, lSpot3 As Long
sTemp$ = sHTML$
Do
 lSpot1& = InStr(lSpot3& + 1, sTemp$, "<")
 lSpot2& = InStr(lSpot1& + 1, sTemp$, ">")
 
  If lSpot1& = lSpot3& Or lSpot1& < 1 Then Exit Do
  If lSpot2& < lSpot1& Then lSpot2& = lSpot1& + 1
  
 sTemp$ = Left$(sTemp$, lSpot1& - 1) + Right$(sTemp$, Len(sTemp$) - lSpot2&)
 lSpot3& = lSpot1& - 1
Loop
StripHTML$ = sTemp$
End Function

Upload
<script language=javascript>
alert ("type alert here")
</SCRIPT>
</head>
</html>
Оригинальные комментарии (3)
Восстановлено из Wayback Machine