日期:2014-05-16 浏览次数:20888 次
var result = File.ReadAllLines(@"C:\Users\myx\Desktop\test.txt", Encoding.GetEncoding("GB2312")).Where(a => {
var m=Regex.Match(a, @"(?<=^
------解决方案--------------------
\s)(\d{1,2}):(\d{1,2}):(\d{1,2})");
int s = 0;
if(!string.IsNullOrEmpty(m.Value))
s = Convert.ToInt32(m.Groups[1].Value) * 60*60+Convert.ToInt32(m.Groups[2].Value) * 60 + Convert.ToInt32(m.Groups[3].Value);
if (s > (10 * 60 + 5) && s < (20 * 60 + 33))
return true;
else
return false;
});
谢谢~我试下
.Where=> 是linq吗?
可惜了,我项目是.net 2.0的,linq用不了!
List<string> list = new List<string>();
foreach (string