Mega Code Archive

 
Categories / C# / Data Types
 

New Line Separated String To Array

//CruiseControl is open source software and is developed and maintained by a group of dedicated volunteers.  //CruiseControl is distributed under a BSD-style license. //http://cruisecontrol.sourceforge.net/ using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Text; using System.Text.RegularExpressions; namespace ThoughtWorks.CruiseControl.Core.Util {     /// <summary>     /// Class with handy stirng routines     /// </summary>     public class StringUtil     {         public static string[] NewLineSeparatedStringToArray(string input)         {             if (string.IsNullOrEmpty(input))                 return new string[0];             List<string> targets = new List<string>();             using (StringReader reader = new StringReader(input))             {                 while (reader.Peek() >= 0)                 {                     targets.Add(reader.ReadLine());                 }             }             return targets.ToArray();         }     } }