Search
Learn
Share

C# - Split string at new lines

Published by Profile Image DevDashboard on 30 September, 2015
388 views
string[] lines = yourString.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

Alternative (from ToSchulz616):

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