A
A
Anton @ Lyalin2017-01-19 16:13:29
Java
Anton @ Lyalin, 2017-01-19 16:13:29

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();
               }
           }
        }

Here is one of the strings ( nrf String; rOE String; ZHz Float; SyU Integer; BFC Integer; zjr Float; IeQ Integer; Sgw Integer, )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Zemlyakov, 2017-01-20
@redtom

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 question

Ask a Question

731 491 924 answers to any question