更新时间:2023-12-03 19:38:52
尝试类似的方法,如果您的文件很小,那么下面的解决方案应该不是问题。
Try something like this, If your file is small then below solution shouldn't be a problem.
string rawdata = @"24 august 2013 г.,,14:00,00:00,;
24 august 2013 г.,,14:00,00:00,;
24 august 2013 г.,2342,14:00,00:00,23424;
24 august 2013 г.,2342,14:00,19:00,23424;";//consider this is raw file
string[] lines = rawdata.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
List<string> result = new List<string>();
foreach (var line in lines)
{
if (!line.Contains("24 august 2013 г.,2342"))
{
result.Add(line);
}
}
现在您的预期结果将在结果
列表。您可以使用结果列表创建一个新文件。
now your expected result will be in result
List. You can create a new file with result List.
如果这不能回答您的问题,请提供更多信息。我会尝试提供更好的解决方案。
If this is not answering your question give more info. I'll try to give better solution.