首页 > 编程语言 >C# .Net 以换行符(\r\n)分割字符串

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

时间:2022-11-02 21:35:23浏览次数:45  
标签:ToList StringSplitOptions string C# StringsContent 字符串 Net 换行符

字符串数字的形式:

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();

 

标签:ToList,StringSplitOptions,string,C#,StringsContent,字符串,Net,换行符
From: https://www.cnblogs.com/guangfangxiaokeai/p/16852528.html

相关文章