escaping tricky string to CSV format
I use this code and it has always worked: /// <summary> /// Turn a string into a CSV cell output /// </summary> /// <param name=”str”>String to output</param> /// <returns>The CSV cell formatted string</returns> public static string StringToCSVCell(string str) { bool mustQuote = (str.Contains(“,”) || str.Contains(“\””) || str.Contains(“\r”) || str.Contains(“\n”)); if (mustQuote) { StringBuilder sb = … Read more