0

I have variables like these :

string text1 = "its my text";
string text2 = "really";
string text3 = "it's mine";

And i have string builder:

StringBuilder csvcontent = new StringBuilder();

I'm concatenate all strings to one:

string forAppend = text1+ "," + text2 + "," + text3 + ",";
csvcontent.AppendLine(forAppend);

I'm separating them with "," because i want them to separated cells in excel. Last step i'm writing this data to excel :

File.AppendAllText(path, csvcontent.ToString());

It's working good. But if i have "," in a string it's separating cell. I just want to have 3 cells how can i escape "," in string variable?

Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
sword1st
  • 525
  • 3
  • 7
  • 21

0 Answers0