子字符串不打破HTML C# [英] Substring without breaking html c#
本文介绍了子字符串不打破HTML C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我正在尝试使用一个已经在wysiwyg编辑器中输入的描述,并取得它的一个子字符串。
ie
Hi guys I'm trying to take a description which has been entered in a wysiwyg editor and take a substring of it..
i.e
我想在不破坏html的情况下限制一些描述,如果我只是子字符串并添加...
This is some <span style="font-weight:bold;">text</span>
它打破了html标签..
I'd like to limit some descriptions without breaking the html if i just substring and add ...
我试过了:
I've tried:
但它并不能帮助我!
推荐答案
解决方案
a>加载HTML,然后得到InnerText。
Use the HTML Agility Pack to load the HTML and then get InnerText.
var document = new HtmlDocument();
document.LoadHtml("...");
document.DocumentNode.InnerText;
这篇关于子字符串不打破HTML C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文