我想在拆分操作中删除空字符串和空字符串:
string number = "9811456789, ";
List<string> mobileNos = number.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(mobile => mobile.Trim()).ToList();
我试过了,但这并没有删除空白条目
最佳答案
var mobileNos = number.Replace(" ", "")
.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
关于c# 拆分字符串并删除空字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46467258/