一、
public static List<string> GetTxtListByContent(string content, bool withBlank = false) { content = content.Replace(" ", " "); content = content.Replace(" ", " "); if (!withBlank) { content = content.Replace(" ", " "); content = content.Replace(" ", " "); } string[] array = Regex.Split(content, " ", RegexOptions.IgnoreCase); var list = new List<string>(array); return list; }
二、
public static List<string> ReadAllLineOfString(string contnet) { var lines = new List<string>(); using (StringReader sReader = new StringReader(contnet)) { string line; while ((line = sReader.ReadLine()) != null) { lines.Add(line); } } return lines; }