Reputation: 5369
My code doesn't remove the carriage return from the string:
Imports System
Imports Microsoft.VisualBasic
Public Module Module1
Public Sub Main()
Console.WriteLine("Hello World")
Dim s As String = "your string" + Chr(10) & Chr(13) + "testing".Replace(vbCrLf, "")
Console.WriteLine(s)
End Sub
End Module
dotnetfiddle: https://dotnetfiddle.net/4FMxKD
I would like the string to look like "your string testing"
Upvotes: 2
Views: 8470
Reputation: 25027
Note that vbCrLf is equivalent to Chr(13) & Chr(10).
Also, as Plutonix pointed out, you are applying .Replace
to the string "testing". And you want to replace it with a space, according to your desired output.
So what you should have is
Dim s As String = ("your string" & Chr(13) & Chr(10) & "testing").Replace(vbCrLf, " ")
Finally, the above assumes that you meant that you want to replace the entire CRLF sequence rather than just the carriage return (Chr(13)).
Upvotes: 7