特定の文字が数行ごとに行の先頭で繰り返されるテキストファイルがあります。いいえ。間にある行の数は固定されていません。この状態が発生している行を見つけることができます。その間の行を読みたい。
using (StreamReader sr = new StreamReader(@"text file"))
{
string line;
while ((line = sr.ReadLine()) != null)
{
if (line.StartsWith("some character"))
次回、この文字が発生するため、コードは同じままです。間にある行を読むことができません
たとえば。
Condition at the begining of a line
Next line
Next line
Condition at the begining of a line
Next Line
Next Line
Next Line
Next Line
Condition at the begining of a line
私はその間の行を読まなければなりません。状態は毎回同じままです。ありがとう。