Replace space with comma and create a new file name

  • Thread starter Thread starter adnan_salah84
  • Start date Start date
A

adnan_salah84

Guest
Hi guys, I am using C# 5.0 and VS 2013.

Here is my sample program code:

string path = "file.txt";

using (TextReader tr = File.OpenText(input))
{
while (tr.Peek() > 0)
{
Console.WriteLine(tr.ReadLine());
}
}

So i build it and here is my output in console:

aa bb "cc"
xx yy "zz"
rr pp "ww"

But now i want to replace all space with comma and remove double quotes and last value should be one in all rows then save it to new file name e.g file2.txt:
aa,bb,cc,1
xx,yy,zz,1
rr,pp,ww,1

Any idea?
Thanks

Continue reading...
 
Back
Top