Commons CSV 是一个用来读写各种 Comma Separated Value (CSV) 格式文件的 Java 库.
Maven:
<groupId>org.apache.commons</groupId> <artifactId>commons-csv</artifactId> <version>1.0</version>
示例代码:
Reader in = new FileReader("path/to/file.csv"); Iterable<CSVRecord> records = CSVFormat.EXCEL.parse(in); for (CSVRecord record : records) { String lastName = record.get("Last Name"); String firstName = record.get("First Name"); }