Results 1 to 2 of 2
Thread: reading text file
- 02-04-2010, 11:40 PM #1Member
- Join Date
- Oct 2008
- Rep Power
reading text file
here is what im trying to figure out. I need to read a text file into a program evaluate the content and place in an array for future use. Heres how a line of text looks:
tab is whitespace between the Long values.
always 2 Long values
0 (tab) 1454
I am using Scanner and have found a way to accomplish this, but I know there is an easier way.
is there any way I can do this : Line = 0 (tab) 1454
and break that down into two variables.
S1 = 0; S2= 1454;
One solution: Read in a line and then use String#split(String regex) to split it into two.
Another: use another Scanner object to read in the line via nextLong().
- By diegosened in forum New To JavaReplies: 4Last Post: 01-15-2010, 11:32 PM
- By balaji csc in forum New To JavaReplies: 1Last Post: 11-10-2009, 11:38 AM
- By balaji csc in forum New To JavaReplies: 1Last Post: 11-09-2009, 11:06 AM
- By matt_well in forum New To JavaReplies: 36Last Post: 07-22-2008, 02:55 AM
- By Lennon-Guru in forum New To JavaReplies: 1Last Post: 12-15-2007, 11:38 PM