I have this text.There is a new line before </ul>
tag. So I could't remove that line with this code.
str = str.Replace(Environment.NewLine,"");
But this code is working for just usual string.
<ul style="list-style-type:circle;">
<li><a class="ms - wikilink" href="/Test.aspx">Test1</a></li>
</ul>
You can remove it with Regex easily
Regex.Replace(stringValue, @"\t|\n|\r", "");
I hope it helps!
This might do the trick for you
var regex = new Regex(@"(?<=>)\s+?(?=<)", RegexOptions.Multiline);
var outstr = regex.Replace(YourHTMLString,"");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With