This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to read csv file & which collection should be used ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to read csv file & which collection should be used ?" Watch "How to read csv file & which collection should be used ?" New topic
Author

How to read csv file & which collection should be used ?

Rahul B. Shah
Greenhorn

Joined: Jan 17, 2011
Posts: 24
Hello,
Can anyone guide me how to read csv file & which collection is suitable.

csv file :
Name test
FirstName First_Name
LastName Last_Name

Name test2
FirstName First_Name
LastName Last_Name
Email User_Email
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19685
    
  20

Our AccessingFileFormats FAQ lists a few libraries that can read CSV files.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Rahul B. Shah
Greenhorn

Joined: Jan 17, 2011
Posts: 24
Thanks Rob,
I have done following :


I get following output on console :

# Lookup Name
Test Lookup 1

#Type
Refresh

First Name
FIRST_NAME

Last Name
LAST_NAME

ORGANIGATION
USER_ORGANIZATION



# Lookup Name
Test Lookup 2

#Type
Append

First Name
FIRST_NAME

Last Name
LAST_NAME

ORGANIGATION
USER_ORGANIZATION

Email
USER EMAIL

& now i am stuck on how to get these values so that i can use in my function ....

[Edit - added code tags - MB]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41635
    
  55
This code will not work for all CSV files, as it ignores several CSV features. CSV is not as trivial to parse as it first looks; that's why Rob pointed you to existing libraries,


Ping & DNS - my free Android networking tools app
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to read csv file & which collection should be used ?