문제

I want to read a .csv file which has some repeated lines. I want to read between this repeated line. For example a is the repeated line and before the second a, I have lines such as 1,2,3.

I want to read write these values between a values. Can you help me?

도움이 되었습니까?

해결책

It was a bit unclear. But perhaps this will do:

var lines = new List<string>(File.ReadLines("input.csv"));
foreach (string line in lines)
{
    if (line.StartsWith("a")) continue;
    // insert code to modify the other lines
}
// ... and later
File.WriteAllLines("output.csv", lines);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top