Menu

csvreader_example

HuDeanY
public void main(String[] args) {
    File fileToShow = new File(System.getProperty("user.home") + File.separator + args[0]);
    try (CsvReader reader = new CsvReader(new FileInputStream(fileToShow))) {
        List<String> dataLine;
        while ((dataLine = reader.readNextCsvLine()) != null) {
            StringBuilder outputline = new StringBuilder();
            for (String value : dataLine) {
                if (outputline.length() > 0) {
                    outputline.append(" ");
                }
                outputline.append(value);
            }
            System.out.println(outputline);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

Related

Wiki: Home

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.