How to Split a String

you can use

text.Split(new string[ ] {Environment.NewLine + Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)

The combined Environment.NewLine + Environment.NewLine as this will only split when a new line is also followed by a new line and split accordingly.

String[ ] people = text.Split(new string[ ] { “\r\n\r\n” },StringSplitOptions.RemoveEmptyEntries);

This will also work.

Regards…!!
Aksh

6 Likes