111,126
社区成员
发帖
与我相关
我的任务
分享public static IEnumerable<string> GetMessages(string s)
{
return Regex.Matches(s, @"^C\d{5}\b", RegexOptions.Multiline).Cast<Match>().Select(match => String.Format("温馨提示:{0} 已达到强制报废标准!", match.Value));
}
foreach (var s in GetMessages("源字符串"))
{
Console.WriteLine(s);
}


string[] strfromtxt = File.ReadAllLines(@"C:\1.txt", Encoding.GetEncoding("GB2312"));
for (int i = 0; i < strfromtxt.Length; i++)
{
richTextBox1.AppendText("温馨提示:" + strfromtxt[i].Substring(0, 5) + "已达到强制报废标准!" + "\n");
}