卸下字符串回车字符串

由网友(曾经的回忆丶只剩回忆)分享简介:我想将以下内容插入一个字符串I would like to insert the following into a stringsome text heresome text heresome text here我希望它进入一个字符串如下:I want it to g...

我想将以下内容插入一个字符串

I would like to insert the following into a string

<p>some text here</p>
<p>some text here</p>
<p>some text here</p>

我希望它进入一个字符串如下:

I want it to go into a string as follows

<p>some text here</p><p>some text here</p><p>some text here</p>

即。无需回车。

i.e. without the carriage returns.

我如何做到这一点?

推荐答案

由于您使用VB.NET,你需要以下code:

Since you're using VB.NET, you'll need the following code:

Dim newString As String = origString.Replace(vbCr, "").Replace(vbLf, "")

您可以使用在C#中的转义字符( r ñ),但这些都不行在VB.NET。你必须使用等效常数( VBCR vbLf )来代替。

You could use escape characters (r and n) in C#, but these won't work in VB.NET. You have to use the equivalent constants (vbCr and vbLf) instead.

阅读全文

相关推荐

最新文章