hi…
I want to delete multiple blank lines from a text file. below is the text file for the reference.
More Options
Prasad
Loading more results…
Add
Options
Anant
qwerty
hi…
I want to delete multiple blank lines from a text file. below is the text file for the reference.
More Options
Prasad
Loading more results…
Add
Options
Anant
qwerty
Hi.
Well one way is to use the Join and Split methods…
Split by the Newline then join back together.
String.Join(System.Environment.Newline, text.Split({System.Environment.Newline},System.StringSplitOptions.RemoveEmptyEntries) )
Another way would be to use Replace…
Assuming there are 2 Newlines together
text.Replace(System.Environment.Newline+System.Environment.Newline, System.Environment.Newline)
Regards.
Thank you very much ClaytonM. It worked for me