I have a c# app that reads a text file and looks for ^ characters and replaces them with \t. It also looks for | characters and attempts to replace them with \n. This .txt file should then be copied into a spreadsheet. The problem is that when the app replaces | it creates a new row of cells. I want it kept in the same cell.
For example the input is:
This^is^testing^to^see|if|it|works
The output I need is:
This is testing to see
if
it
works
Instead I get:
This is testing to see
if
it
works
I am currently using:
File.WriteAllText(textBox1.Text, File.ReadAllText(textBox1.Text).Replace("|", "\n"));
File.WriteAllText(textBox1.Text, File.ReadAllText(textBox1.Text).Replace("^", "\t"));
Where am I slipping up?
The closure of this question was of no help. \r\n does the same thing. I need the replacement of the | delimiter to keep the information in the same cell. As you can see it the above example it is moving it a row down into the A (first) column thanks to the \n I assume.