c# .net

How to split string by \n c#?

How to split string by \n c#?, someone asked me to explain?

In this tutorial I will show you how to split string on "\n" to new line in c#. If you have a line break in paragraph text, it will split perfectly.

C# Code for split on string:


string[] lines = paragraphs.Split(
    new string[] { "\r\n", "\r", "\n" },
    StringSplitOptions.None
);

Post your comments / questions