我有一个html节点:
<p>Line1 Line2 Line ThereAreTwoSpacesAfterThis ThereAreTwoSpacesBeforeThis </p>
在任何浏览器中,最终使用结果都是
Line1 Line2 Line ThereAreTwoSpacesAfterThis ThereAreTwoSpacesBeforeThis
这就是我想要的结果。
那么,如何去除XmlNodeType.Text文件节点(C#)?
=========================================================
我尝试使用Html敏捷包,但是效果不够好。
有什么好主意吗?
Just use a regular expression!
var spacesSquashed = Regex.Replace(input, @"\s+", " ", RegexOptions.Singleline);
.Trim() 最后。
.Trim()