Results 1 to 2 of 2
Thread: Reading lines into 2d array
- 09-28-2011, 01:07 PM #1
Member
- Join Date
- Jun 2011
- Posts
- 11
- Rep Power
- 0
Reading lines into 2d array
Hi
I need to read a textfile line by line into a two dimensional array.
The array would be an array of strings. I'm thinking to use an arraylist of type string
The string is always two words and the text file contains 15 lines of two word strings.
How do I do this? Can I declare an arraylist of type String and then use the string split method ?
IF so, how do I get the split string elements into the array?
- 09-28-2011, 02:53 PM #2
Re: Reading lines into 2d array
Do you want the data in a 2 dim array or in an ArrayList?
If an array, would each row hold two columns of the data from each file record?
The split method would be useful to parse the line into an arrray of two Strings that could be assigned to each row of the 2 dim array.
Similar Threads
-
Reading Lines
By gkoef in forum New To JavaReplies: 6Last Post: 04-19-2011, 11:08 PM -
reading lines from URL and printing backwards
By luxurymode in forum Advanced JavaReplies: 1Last Post: 03-30-2011, 08:18 AM -
Two '\n' characters between lines while reading File
By subith86 in forum New To JavaReplies: 6Last Post: 02-26-2011, 09:56 AM -
problem reading a files lines
By j187 in forum New To JavaReplies: 1Last Post: 12-17-2010, 12:43 AM -
Reading specific lines
By ivvgangadhar in forum New To JavaReplies: 8Last Post: 01-12-2009, 08:53 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks