且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

检查HtmlString在C#中是否为空格

更新时间:2023-11-29 15:21:28

您可以使用 HtmlAgilityPack ,像这样的东西:

You can use HtmlAgilityPack, something like this:

HtmlDocument document = new HtmlDocument();
document.LoadHtml(Model.ContentField.Value);
string textValue = HtmlEntity.DeEntitize(document.DocumentNode.InnerText);
bool isEmpty = String.IsNullOrWhiteSpace(textValue);