Return to Snippet

Revision: 50387
at August 19, 2011 06:36 by m1b


Initial Code
import au.com.bytecode.opencsv.CSVWriter;
import java.io.*;

public class Csv {

    public static void main(String[] main) throws Exception{
        BufferedWriter out = new BufferedWriter(new FileWriter("result.csv"));
        CSVWriter writer = new CSVWriter(out);
        String[] values = {"1","first","second","Third one quoted with a, comma","fourth \"double quotes\"\n line break"};
        writer.writeNext(values);
        values = new String[]{"2","erst","zweite","Dritte,mit Komma","viertl"};
        writer.writeNext(values);
        values = new String[]{"3","primero","segundo","tercero","cuarto,con la coma"};
        writer.writeNext(values);
        out.close();
    }
}

Initial URL
http://opencsv.sourceforge.net

Initial Description

                                

Initial Title
Writing a CSV file with Java using OpenCSV

Initial Tags
java, csv

Initial Language
Java