Click here to Skip to main content
16,016,022 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all, i was wounding if anybody can help with this I will be really grateful
I am working on a piece of software to read a comma separated text files with thousands of lines each line has around 32 word separated with a comma
What my code does at the moment it reads the file line by line choose 11 words out of the 32 and outputs them into a new file. This is actually time consuming although i used threads and a progress bar my manager still not happy.
So i was thinking if i can read the whole text file into a 2 dimensional array and then choose certain Colums to output on the new file that will make it work much faster. But i dont know how to read a whole colum from a 2 dimensional array. And let us say for example the array is gonna be like array(9500)(32) where the first argument representing the number of lines and the second represents the number of fields in each line.
Is there any way to access it like this array(all lines)(15)
I am using vb.net 2008

Many thanks
Posted
Comments
CPallini 9-Nov-10 5:42am    
Maybe your code is not efficient. Can we have a look at?

No this isn't possible because the value of each item in the same column is 31 items apart from each other. The values are sequential in memory for each row, but not for each column. You would have to transpose (columns to rows and rows to columns) it but that would give the same overhead.

Good luck!
 
Share this answer
 
Comments
Mahmoud209 9-Nov-10 6:21am    
thanks i think u r true
It's not possible. You'd still have to read each line, parse it into individual words, adding them to your array. You're not saving anyn time here.

There's no "automatic" way of doing it, though you might get a bit of a performance improvement using a RegEx to do the parsing.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900