2010-06-07 6 views

Répondre

1

Vous devrez supprimer la chaîne dans <strong> de chaîne dans <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("https://stackoverflow.com/a/strong").InnerText; 
var resultString = strWithinAnchor.Replace(strWithinStrong, string.Empty);