• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

extract content from table

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What have you tried so far?
 
saurabh sood
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i havnt been able to think ogf a logic to do so
saurabh sood
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Think of how dumb the average person is. Mathematically, half of them are EVEN DUMBER. Smart tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic