How change the default separator of opencsv?

Viewed 4536

First of all, hello and sorry for the beginner question but I already saw the documentation and tutorials but I can't make it work on my code. Maybe I'm making a little mistake but I can't catch it.

I'm using the latest version of opencsv in a maven project. So I need to make a .csv file and for that I use:

try (CSVWriter writer = new CSVWriter(new FileWriter("file.csv", true)) {
    /* code
}

And everything works fine, but I need to use a diferent separator, so I try with:

try (CSVWriter writer = new CSVWriter(new FileWriter("file.csv", true), '-') {
    /* code
}

But appears Cannot resolve constructor 'CSVWriter(java.io.FileWriter, char)' in IntelliJ, when in the documentation says opencsv documentation

Any idea on how fix it? (Sorry for my english, I'm not native speaker).

1 Answers
Related