credo di aver trovato la funzione!
grazie
codice:
<%
'FUNCTION STRIPHTML
'VER 1.0.1
'----------------------------------------------------------------------------
'COSA FA
'Permette di eliminare le TAG HTML da un testo generico.
'----------------------------------------------------------------------------
'PARAMETRI IN INGRESSO
'StrHTML : Il testo che puo' contenere le tag HTML
'StrEsclusioni : Elenco CSV delle TAG da escludere dallo Strip. (Includere
'anche le eventuali tag di chiusura nell'elenco, A, /A, DIV, /DIV...)
'----------------------------------------------------------------------------
'RESTITUISCE
'restituisce il testo senza le TAG HTML.
'----------------------------------------------------------------------------
'ESEMPIO DI UTILIZZO
'StripHTML("Con gli Hackers e' meglio mettere un firewall", Null)
'StripHTML("Grosso Grosso
Chi?</p>", "B, /B")
'----------------------------------------------------------------------------
'VER 1.0.0 del 03/09/2002
'Prima versione.
'VER 1.0.1 del 30/09/2002
'Aggiunta la possibilita' di escludere delle tag dallo strip.
'QUESTA VERSIONE NON E' COMPATIBILE CON LA PRECEDENTE
'----------------------------------------------------------------------------
Function StripHTML(ByVal StrHTML, ByVal StrEsclusioni)
Dim BoolTAG, BoolEsclusioni
Dim IntI, IntR, IntTotale
Dim ArraySplit
BoolEsclusioni = false
if StrEsclusioni<>"" and not IsNull(StrEsclusioni) then
BoolEsclusioni = true
ArraySplit = Split(StrEsclusioni, ", ")
end if
'Response.write("<hr>" & Server.HTMLEncode(StrHTML) & "<hr>")
IntTotale = Len(StrHTML)
'Analizzo il testo per riscontrare la presenza di TAG
For IntI = 1 To IntTotale
'Response.write("
Mid(StrHTML, IntI, 1) = " & Mid(StrHTML, IntI, 1))
Select Case Mid(StrHTML, IntI, 1)
Case "<"
BoolTAG = True
if BoolEsclusioni then
For IntR=0 to UBound(ArraySplit)
'Response.write("
1) Escludere : '" & Server.HTMLEncode(ArraySplit(IntR)) & _
' "'
Porzione HTML analizzata '" & Server.HTMLEncode(Mid(StrHTML, IntI, (Len(ArraySplit(IntR))+1))) & _
' "'
Stringa di confronto '" & Server.HTMLEncode(CStr("<"&ArraySplit(IntR))) & "'")
if UCase(Mid(StrHTML, IntI, (Len(ArraySplit(IntR))+1))) = UCase(CStr("<"&ArraySplit(IntR))) then
BoolTAG = False
StripHTML = StripHTML & Mid(StrHTML, IntI, 1)
Exit For
end if
Next
'Response.write("
Stampare? " & Not(BoolTAG))
end if
Case ">"
If Not BoolTAG Then StripHTML = StripHTML & Mid(StrHTML, IntI, 1)
BoolTAG = False
Case Else
'Se mi trovo in una tag non stampo a video il testo
'Se non mi trovo in una tag accodo il testo all'output
If Not BoolTAG Then StripHTML = StripHTML & Mid(StrHTML, IntI, 1)
End Select
Next
Set BoolTag = Nothing
Set IntI = Nothing
Set IntTotale = Nothing
If BoolEsclusioni Then Erase ArraySplit else Set ArraySplit = Nothing
End Function
%>