다음은 텍스트 파일에서 숫자를 검색하기 위해 함께 사용하는 코드입니다. 그것은 내가하려는 일에 아주 효과적이다. 지금 그것은 7 개의 위치를 찾는다. 그리고 나는 7 개의 다른 색인에서 선을 읽을 필요가있다. 이것을 시작하는 가장 좋은 방법은 무엇일까요? 고마워,이 C#입니다.다른 인덱스의 행 읽기
private void button1_Click(object sender, EventArgs e)
{
richTextBox1.Text = "";
using (OpenFileDialog dlgOpen = new OpenFileDialog())
{
//long count = 0; string line;
//bool start = false;
//string line;
List<String> LinesFound = new List<string>();
// Available file extensions
dlgOpen.Filter = "All files(*.*)|*.*";
// Initial directory
dlgOpen.InitialDirectory = "C://bin";
// OpenFileDialog title
dlgOpen.Title = "Load";
// Show OpenFileDialog box
if (dlgOpen.ShowDialog() == DialogResult.OK)
textBox1.Text = dlgOpen.FileName;
{
string str = System.IO.File.ReadAllText(dlgOpen.FileName);
Regex reg = new Regex("333333");
Match sat = reg.Match(str);
while (sat.Success)
{
richTextBox1.Text += (sat.Index + " "); //shows index where 333333 is
sat = reg.Match(str, sat.Index + sat.Length);
{
{
}
}
}
}
}
}
이것이 어떤 언어인지 언급하면 도움이 될 것입니다. 나는 C# 또는 아마도 ASP를 추측하고 있습니다. –