在Java中解析CSV [英] Parsing CSV in java

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

问题描述

我有这种奇怪的情况,我必须水平阅读。所以我得到一个csv文件,其中有水平格式的数据。如下:

I have this weird situation where I have to read horizontally. So I am getting a csv file which has data in horizontal format. Like below:

CompanyName,RunDate,10/27/2010,11/12/2010,11/27/2010,12/13/2010,12/27/2010....

RunDate后显示的所有日期运行日期字段的值,我必须更新该系统中该公司的字段。日期值不是固定数字,它们可以是单个值到10到n数字。所以我需要读取所有这些值并在系统中更新。

All the dates shown after RunDate are values for run date field and I have to update that field for that company in my system. The date values are not fix number, they can be single value to 10 to n number. So I need to read all those values and update in the system. I am writing this in Java.

推荐答案

OpenCSV 处理所有奇怪的CSV文件(新行,分隔等)的情况。

Libraries like OpenCSV handle all the weird cases for CSV files (new lines, delimiting, etc).

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆