Author
Read CSV in a map
Manzoor Elahi
Greenhorn
Joined: May 11, 2010
Posts: 11
Hi ,
I have a CSV file as below
VALUE 1A , VALUE 1B
VALUE 2A , VALUE 2B
VALUE 3A , VALUE 3B
etc
i need to store the values in a map as a key value pair, map<VALUE1A , VALUE1B>so on, so that i can process it further.
Can someone please help me how to do it. I end up inserting same values as both the key and value.
If someone can provide a code snippet it would be really helpful
TIA
Manzoor
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35443
posted May 12, 2010 00:06:05
0
Instead of implementing your own CSV parser (which isn't quite as trivial as it seems at first), I'd use one of the existing libraries; see AccessingFileFormats for links to some of them.
Android apps – ImageJ plugins – Java web charts
subject: Read CSV in a map