日期:2014-05-18  浏览次数:20685 次

求救~~文本读写问题~~急急
文本内容如下:
aa
cc
vv
bb
(dd-ff-fdf)
ss

我想要把 "dd-ff "   读出来该怎么做??
谢谢各位大虾们...急需~~

------解决方案--------------------
try

using (StreamReader sr = new StreamReader(@ "e:\test.txt ", System.Text.Encoding.Default))
{
bool flag = false;
while (sr.Peek() > = 0)
{
if (sr.ReadLine().IndexOf( "dd-ff ") > -1)
{
MessageBox.Show( "存在 ");
flag = true;
break;
}
}
if (!flag)
MessageBox.Show( "不存在 ");
}