extract a text, from a text file, that is contained between two strings

extract a text, from a text file, that is contained between two strings

Post by Giordan » Sun, 01 Jun 2008 03:38:49


Hi to everybody...

Can you tell me your best way to
extract a text, from a text file, that is contained between two
strings

example: we have a file which contains these words
<<
Ei fu. Siccome immobile,
dato il mortal sospiro,
stette la spoglia immemore
orba di tanto spiro,
...

I want extract that word contained between the 2 words "la" and
"immemore"
(this word will be "spoglia" at 3rd row, but I mean that more words
could be present & contained in the same 'range')

Thanks to everybody,
I will be happy to read your opinions.
:)
Bye
 
 
 

extract a text, from a text file, that is contained between two strings

Post by Dave Mille » Sun, 01 Jun 2008 06:04:12


If your markers (la and immemore) are constant, read the file into a
String, use indexOf(String) to find each and then substring the range in
between.

--
Dave Miller
Java Web Hosting at:
http://www.yqcomputer.com/

 
 
 

extract a text, from a text file, that is contained between two strings

Post by Giordan » Sun, 01 Jun 2008 07:07:43

Ok, thanks, this is a way
:)

Other solutions ?
 
 
 

extract a text, from a text file, that is contained between two strings

Post by Giordan » Fri, 06 Jun 2008 03:58:32

Roedy,
Thanks so much for your answer and sorry if my comment has arrived so
late
:)