我在将文本打印到 .csv 文件时遇到问题。我的字符串中有一个逗号,我最终将它打印到两个单元格而不是一个单元格。这是代码:
String companyName1 = "Edison Corporation, LLC co";
String profit1 = "$100";
String fileName = "Result.csv";
File file = new File(fileName);
output = new PrintWriter(file);
output.println(companyName+","+profit);
//This gives me the following:
// Edison Corporation LLC co $100
//I need:
// Edison Corporation, LLC co $100