0

I want to be able to read data from a csv file (comma seperated,tab seperated or space seperated) and pass the data into an array.my intentions are to combine four classes. such as a class for the data model,file reader, driver and textui. i can handle the textui and the driver but am finding it dificult with the other two classes as i am a beginner. Anyone care to help with some sample codes

3
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by NormR1
0

You need to look at how to do two things:
1) Read lines from the file. An easy way to do this is using the Scanner class.
2) Split the lines at the comma: See the String class's split() method

0

thank you very much, that really helped. i want to further pass the data read from the csv file into a table. How do i go about it please?

0

Let's assume that you are going to put the file reading code into a method, eg readDataFrom(File f). In that method all you need to to do is to read the file, split the lines (as Norm said) and add that data to a 2D array. Finally you return the array. Then, when you need the data somewhere else you just call that method.

0

Thank you very much guys for all your contributions. my program is up and running. However i need to pass some information into the program to do some certain things.The program reads a csv file with data in rows and columns(source Data). it also reads a csv file with rows and columns(target data) on the same GUI but different panels. i want to pass mapping rules as an input to populate the target data and do some restructuring to support the target data.Please what kind of free grammar language do i use to write and how do i arrange these instructuctions that the system will understand and implement.

0

How do create an XSLT template to create transformation rules in rearranging a source data to conform to a target data.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.