Java API的CSV API

扫码查看
本文介绍了Java API的CSV API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以推荐一个简单的API,它允许我使用读取CSV输入文件,做一些简单的转换,然后写入。

Can anyone recommend a simple API that will allow me to use read a CSV input file, do some simple transformations, and then write it.

发现看起来很有前景。

我只是想检查别人在使用这个API之前的用法。

I just wanted to check what others are using before I couple myself to this API.

推荐答案

ve过去使用了。

import au.com.bytecode.opencsv.CSVReader;
String fileName = "data.csv";
CSVReader reader = new CSVReader(new FileReader(fileName ));

//如果第一行是标题
String [] header = reader.readNext();

//遍历reader.readNext直到返回null
String [] line = reader.readNext();

// if the first line is the headerString[] header = reader.readNext();
// iterate over reader.readNext until it returns nullString[] line = reader.readNext();

这篇关于Java API的CSV API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 04:37
查看更多