i have a text file like below :
string string
string string
string string
string string
i want to replace all these spaces with pipe (|) character.
is there any method in c# for doing that?
i am using the below codes for read and write on file :
How do I read and edit a .txt file in C#?
EDIT:
after using the codes in the accepted answer i got the below error in line of
System.IO.File.WriteAllLines( …:
Could not find file ‘C:\Program Files\Common Files\Microsoft
Shared\DevServer\10.0\infilename.txt’.
[Solves by absolute path]
thanks for comments and answers :
not each space with one pipe -> all spaces in each line with one pipe…
thanks in advance
Change the aanund’s answer in: