Answer the question
In order to leave comments, you need to log in
Why does opencsv add a comma after each line???
I write the csv file as an array of lines, and after writing each line, it adds a comma. How to remove it?
try {
csvWriter = new CSVWriter(new FileWriter(FILEOUT, false));
csvWriter.writeNext(STRING, false);
csvWriter.flush();
} catch (Exception e){
System.err.print("");
} finally {
if (csvWriter != null){
try {
csvWriter.close();
} catch (Exception e){
e.printStackTrace();
}
}
}
Answer the question
In order to leave comments, you need to log in
CSV uses this character as a delimiter. try to see what methods csvWriter has. There should be something like csvWriter.setSplitter. However, the format itself implies the presence of a separator in any case, be it a semicolon, a comma, or some other sign. So he marks the borders of the cell. After all, csv, according to its idea, is an excel document in one line and of a smaller volume.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question