Remove carriage return from string

前端 未结 9 2114
逝去的感伤
逝去的感伤 2021-01-03 17:41

I would like to insert the following into a string

some text here

some text here

some text here

9条回答
  •  旧巷少年郎
    2021-01-03 18:07

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

    Dim newString As String = origString.Replace(vbCr, "").Replace(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.

提交回复
热议问题