The file format is look like
abc def
ghy jk
lmp
And here is my code
System.IO.StreamReader file =
new System.IO.StreamReader("./test.txt");
string afterreplace = "";
while ((line = file.ReadLine()) != null)
{
Console.WriteLine(line);
afterreplace = String.Concat(afterreplace, line);
}
Console.WriteLine(afterreplace);
However I got this in my output
It doesn't match the original file
abc def ghy jk lmp
Of cause I can add some newline character, I really want to know why it cause
Does
String.Concat
ignore the '/n' ?
How could I achieve my expectation?
thx a lot.
Aucun commentaire:
Enregistrer un commentaire