什么是csv文件以及如何使用java代码解析它? [英] What is csv file and how to parse it using java code?
问题描述
可能重复:
快速CSV解析
如何正确解析CSV文件到二维数组?
我很新的java文件处理。请问,任何人都可以告诉我什么是CSV文件格式,以及如何解析这种类型的文件?
I'm very new to java file handling. Please, can any one tell me what is "CSV file format," and how to parse this type of file?
我想从一个输入员工数据CSV文件并将其保存在哈希映射中。
I want to take an input of employee data from a CSV file and save it in a hash map.
推荐答案
CSV代表逗号分隔值。
CSV stands for Comma Separated Values.
此处的数据存储如下:
ID,Name,Age
20,"abcd xyz",33
30,asdf,28
OpenCSV 是一个很好的解析CSV文件的库。
OpenCSV is one good library for parsing CSV files.
还有其他表兄弟CSV,例如TSV(制表符分隔值)和PSV(管道分隔值)。以下链接应该为您提供一个良好的开端:
There are other cousins of the CSV such as TSV (Tab Separated Values) and PSV (Pipe Separated Values). The below link should give you a head start:
http://en.wikipedia.org/wiki/Delimiter-separated_values
这篇关于什么是csv文件以及如何使用java代码解析它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!