import org.nuiton.csv.CSVReader; import org.nuiton.csv.CSVWriter; public void readCSV(String filePath) { try (CSVReader reader = CSVReader.build(filePath)) { for (String[] row : reader) { for (String cell : row) { System.out.print(cell + " "); } System.out.println(); } } catch (IOException e) { e.printStackTrace(); } } public void writeCSV(String filePath) { try (CSVWriter writer = CSVWriter.build(filePath)) { writer.writeNext(new String[]{"John", "Doe", "john@example.com"}); writer.writeNext(new String[]{"Jane", "Smith", "jane@example.com"}); } catch (IOException e) { e.printStackTrace(); } }


上一篇:
下一篇:
切换中文