Frage

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?

War es hilfreich?

Lösung

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);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top