C# .Net 以换行符(\r\n)分割字符串

字符串数字的形式:

1 string[] StringsContent = strT.Split(new string[] { "\r\n" },StringSplitOptions.None);
2 StringsContent = StringsContent.Where(s => !string.IsNullOrWhiteSpace(s)).ToArray();

List<string>的形式:

1 List<string> StringsContent = strT.Split(new string[] { "\r\n" }, StringSplitOptions.None).ToList();
2                 StringsContent = StringsContent.Where(s => !string.IsNullOrWhiteSpace(s)).ToList();

 

原文地址:http://www.cnblogs.com/guangfangxiaokeai/p/16852528.html

发表评论

您的电子邮箱地址不会被公开。