The moose likes Java in General and the fly likes extract  content from table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "extract  content from table" Watch "extract  content from table" New topic

extract content from table

saurabh sood

Joined: Nov 22, 2000
Posts: 17
i need to extract information(data) from space seprated table that looks as follows:
variable Name Vari Desc. Vari Code
data data data
data data data
this table is embeded in a txt file. please help me out with its logic
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
What have you tried so far?

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
saurabh sood

Joined: Nov 22, 2000
Posts: 17
i havnt been able to think ogf a logic to do so
saurabh sood
rom chatterjee
Ranch Hand

Joined: Dec 11, 2001
Posts: 46
You could try holding the table in memory. This could be a vector of vectors. Vector a has a Vector b in each position. Vector a represents the rows (One vector b is one row). Each object in vecotr b is an entry of column data.
Read the file a line at a time. One line is one row. When you have a line, parse it into n Strings looking for whitespace. Put each string into a vector b. When there are no more entries, place vector b in vector a and move onto the next line (row).
You dont have to use vectors, you could use an array of arrays table[][], where table [0][1] is the value in the second column of the first row.
Conceptually tih is a bit like...
row1[ [col1] [col2] [col3] ]
row2[ [col1] [col2] [col3] ]
Hope this helps

Rom Chatterjee<BR>Sun Certified Java Programmer
I agree. Here's the link:
subject: extract content from table
jQuery in Action, 3rd edition