我在將文本打印到.csv文件時遇到問題。我的字符串中有一個逗號,我最終打印到兩個單元而不是一個。下面是代碼:如何在Java中使用PrintWriter將逗號打印到.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
對不起我的壞...它適用於所有...我需要設置Excel默認分隔符... – Buras 2013-04-06 23:26:21