簡體   English   中英

如何使用C#解碼此html字符串?

[英]How to decode this html string using C#?

我有一些帶有javascript格式字符串的字符串,如下所示:

\u003Cdiv>\u003Cdiv class=\"mbm detail_research\">\u003Cdiv class=\"clearfix\">\u003Ca class=\"_8o _8r lfloat\" href=\"http:\/\/www.abcm.com\/mutily\/post.php?id=2344324342\" 

有人知道如何使用C#將其解碼為普通的html字符串嗎?

我的意思是,它將變成:

<div><div class="mbm detail_research"><div class="clearfix"><a class="_8o _8r lfloat" href="http://www.abcm.com/mutily/post.php?id=2344324342"

解碼后。

謝謝你的幫助!

使用HttpUtility類將其解碼為:

String myDecodedString = HttpUtility.HtmlDecode("Html encoded String here");

遵循這篇MSDN文章

您正在尋找的是Regex.Unescape

var decodedString = Regex.Unescape(yourString);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM