<a> contents <strong>strong content</strong> </a>
我只想在<a>
和<strong>
答案 0 :(得分:1)
您必须从<strong>
-
<a>
中的字符串
var testString = "<a> contents <strong>strong content</strong> </a>";
var doc = new HtmlDocument();
doc.LoadHtml(testString);
var strWithinAnchor = doc.DocumentNode.SelectSingleNode("/a").InnerText;
var strWithinStrong = doc.DocumentNode.SelectSingleNode("/a/strong").InnerText;
var resultString = strWithinAnchor.Replace(strWithinStrong, string.Empty);