This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

extract content from table

 
saurabh sood
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
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
thanks
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you tried so far?
 
saurabh sood
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i havnt been able to think ogf a logic to do so
saurabh sood
 
rom chatterjee
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic