卸下字符串回车 [英] Remove carriage return from string

查看:133
本文介绍了卸下字符串回车的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

这篇关于卸下字符串回车的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆