我想将以下内容插入字符串
<p>some text here</p>
<p>some text here</p>
<p>some text here</p>
我希望它进入如下字符串
<p>some text here</p><p>some text here</p><p>some text here</p>
即没有回车。
我该如何实现?
最佳答案
由于您使用的是VB.NET,因此需要以下代码:
Dim newString As String = origString.Replace(vbCr, "").Replace(vbLf, "")
您可以在C#中使用转义字符(
\r
和\n
),但这些字符在VB.NET中不起作用。您必须使用等效的常量(vbCr
和vbLf
)。关于.net - 从字符串中删除回车,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4906279/