-1

重複の可能性:
ASP.NET で文字列から HTML タグを削除するにはどうすればよいですか?

asp.netでhtmlのテキストコンテンツを取得するには?

asp.net で次のコードを書きましたが、テキストではなく html が返されましたか?

コードはここにあります:

Function GetData(ByVal dta As String)

        Dim comp As New Literal
        comp.Text = dta
            Return comp.Text
End Function

例えば ​​:

入力: <span><p> this is html </p></span>

出力は次のようになります: これは html です

4

1 に答える 1

2

これを試して

Function GetData(ByVal dta As String)

        Return Regex.Replace(dta, "<[^>]*(>|$)", String.Empty)
    End Function
于 2012-12-04T09:12:18.547 に答える