i am coding a method that recieves an arraylist as a parameter, in it there are multiple rows of string in this format: data1;data2;data3;.....datan; i need to parse each row of the list in order to get every single data item in it so i can then build an excel sheet with this data but that's another story what i cannot seem to do propertly is the correct parsing of the string can anyone help me?
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
when you say excel, do you mean excel-like, as in JTable? if so, you can use String.split() for each line, to return a String[] the String[] can be used as an argument for a vector (Collection) this vector is then added to another vector
once you have all your data read in, the vector of vectors is the 'row' argument for the TableModel of the JTable
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
posted
0
Hi, welcome to the ranch!
Is there any chance your data can have a semi-colon in it? What would that look like? Some escape mechanisms can make this a little harder.
BTW: If you just change all the semi-colons to tabs and write it back to disk, Excel will open it right up.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi