How can I change a comma separator by tab delimiter [duplicated]

0

I have a .csv file which the client first asked me to change the separator commas by vertical bars "|"

Now they are asking me to change it by tab delimiter but I can not do it. I have searched for several options but I can not find anything.

Here is the code I have so far:

string Arch = File.ReadAllText(newFileName); //newFileName es el archivo csv

Arch = Arch.Replace(@",""", @"|""");

File.WriteAllText(newFileName.Substring(0, newFileName.Length - 4) + "_Pipping.csv", Arch);

I have tried to replace the @"|""" por @"\t""" but the tabulation does not work. Only export the symbol \ t between each column.

As an example of input and output text.

Input text:

"Username", "FullName"

Output text:

"UserName" "FullName"

How could I make this change?

Thanks

    
asked by A arancibia 27.02.2018 в 19:05
source

1 answer

1

the problem is the @"\t" which prefix @ adds a slash, which would be \t

use it directly without the prefix @

Arch = Arch.Replace(",\"", "\t\"");
    
answered by 27.02.2018 / 21:15
source