Results 1 to 4 of 4
Thread: .txt manipulations
- 11-13-2011, 12:59 PM #1
Member
- Join Date
- Nov 2011
- Posts
- 3
- Rep Power
- 0
.txt manipulations
Hi there,
I am not used towork with .txt files... I want to do what seems to me a quite basic thing but stgle to do it..
I have a file .txt where I have a few lines:
file.txt
line 1
aaaaaaaaa
aaa
line 2
bbbbbbbbbb
bbb
line 3
cccccc
ccc
line 4
dddddddddd
ddd
On the other hands, I have a tables of String table[2] =( "line 2", "line 3").
What I want is to get from file.txt, the string between the 2 String from table ? In my example, I would like to get :
"bbbbbbbbbb
bbb"
Does anyone have some doc about this ? a program ?
Thanks in advance
David
- 11-13-2011, 02:32 PM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
Re: .txt manipulations
the Scanner class has nice methods to handle your problem, look at the api doc for that class here
- 11-14-2011, 11:37 AM #3
Member
- Join Date
- Nov 2011
- Posts
- 3
- Rep Power
- 0
Re: .txt manipulations
Thanks a lot
- 11-14-2011, 12:12 PM #4
Member
- Join Date
- Oct 2011
- Posts
- 15
- Rep Power
- 0
Re: .txt manipulations
You may also find this useful (it's an alternative to Scanner):
Dystopian Code: Text File I/O in Java
Dystopian Code: Text File I/O with Strings that Contain Spaces in Java


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks