Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

find & vbCrLf & within a string - vb.net

Tags:

vb.net

In a string I have something like "First & vbCrLf & Name" - however, I want to take out the & vbCrLf & so it doesnt cause a line break.

I have done something like

If theString.Contains("& vbCrLf &") Then
    ' and replace, could do this above of course, but I just want it to go into the IF
End If 

and

If theString.Contains("\n") Then
    ' and replace, could do this above of course, but I just want it to go into the IF
End If 

and even "\r\n" but to no avail.

What am I missing?

like image 817
user3428422 Avatar asked Jan 09 '23 02:01

user3428422


2 Answers

If theString.Contains(vbCrLf) Then
    'Do something
End If

Alternatively...

theString = theString.Replace(vbCrLf, "")
like image 56
Keith Avatar answered Jan 10 '23 17:01

Keith


Try:

If theString.Contains(Environment.NewLine) Then
   ' Code goes here
End If
like image 40
Jason Musgrove Avatar answered Jan 10 '23 15:01

Jason Musgrove