Results 1 to 2 of 2
Thread: reading text file
- 02-05-2010, 12:40 AM #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-16-2010, 12:32 AM
- By balaji csc in forum New To JavaReplies: 1Last Post: 11-10-2009, 12:38 PM
- By balaji csc in forum New To JavaReplies: 1Last Post: 11-09-2009, 12:06 PM
- 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-16-2007, 12:38 AM