I'm writing a program that reads in a text file or a csv and for each line of text in the file it creates a new object of an aray:
What I need to do is tell my code that if it encounters a comma that it needs to treat it as a new line marker. "\n"
At first I thought I would run a replace statement saying
but it is putting in a literal "\n" which is kicking out illegal char errors. How do I tell my test that if there is a comma consider it a new line?
That way a line like this:
will create 3 objects in my array.
Thanks in advance.
Code:
string[] lines = File.ReadAllLines(@newobject.csvDirectory);
At first I thought I would run a replace statement saying
Code:
line[i].replace(",","\n");
That way a line like this:
Code:
This is line 1,This is line 2, This is line3. And more 3.
Thanks in advance.
Comment