and I intend to seperate them by "column". I know how many columns there are, so it would be easy enough to put them in an array. My problem is that I do not know how many lines of information I have so I could not put this information in a 2-D array without first knowing the size of array to create and to do this I have to go through the file and count the number of lines. I could also create a Vector of String arrays, so that the Vector will resize itself every time I add a new String array (line of information seperated by column) with my data in it. Does anyone have an opinion on the most effiecient way to do this?
Help is always appreciated. Thank you! [ June 12, 2007: Message edited by: Brandi Love ]
I agree with Gregg about using an ArrayList of Customer objects. On a different note though... using split(",") may be problematic, since it's possible that some fields (e.g. company name) might have commas within them. Parsing comma-separated values can be more complex than it seems at first, thanks to special characters and escape sequences. I recommend using an existing CSV parser library - Steve Ostermiller has a good one, and gives links to others.
"I'm not back." - Bill Harding, Twister
Joined: Sep 19, 2003
Thanks for the advice, guys! I'll give it shot.
subject: Data structure to hold information for a file?