How to Remove the space in between the lines

Hi,
example for you, as @Yoichi mentioned:

output = String.Join(vbCrLf, your_String.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries))
output = String.Join(vbCrLf, your_String.Split(vbCrLf.ToArray, StringSplitOptions.RemoveEmptyEntries))

Remove New Line from whole string:

Replace(vbCr, "") - removes \r [CR (Carriage Return)]
Replace(vbLf, "") - removes \n [LF (Line Feed, Environment.NewLine)]
Replace(vbCrLf, "") - removes \r\n [CR+LF ( End Of Line)]

Remove New Line only from the end of string:

textString.TrimEnd(vbCr.ToCharArray)
textString.TrimEnd(vbCrLf.ToCharArray)
textString.TrimEnd(vbCrLf.ToCharArray)

Check this post:

1 Like