Extract columns from text file

Thread Solved
Reply

Join Date: Apr 2006
Posts: 114
Reputation: KimJack is an unknown quantity at this point 
Solved Threads: 0
KimJack KimJack is offline Offline
Junior Poster

Extract columns from text file

 
0
  #1
Sep 17th, 2007
Hello all,

I have a text file with columns of words

Boat Car Van
Sue Bird Hue
Billy Don Yoe...

How do I read each separate column into separate arrays.

Array 1 will read:
Boat
Sue
Billy

Array 2 will read:
Car
Bird
Don...

Any suggestions on how to accomplish this.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,124
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 472
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: Extract columns from text file

 
0
  #2
Sep 18th, 2007
  • read the file line by line
  • split the read line on empty character
  • strings received this way store in your arrays
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 114
Reputation: KimJack is an unknown quantity at this point 
Solved Threads: 0
KimJack KimJack is offline Offline
Junior Poster

Re: Extract columns from text file

 
0
  #3
Sep 18th, 2007
Thanks peter_budo
I will try that
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC