| Author |
How to find a word in a text file? (2)
|
Ekrem Altintas
Greenhorn
Joined: Dec 20, 2005
Posts: 14
|
|
hellohowareyouhellohowareyou For example, I want to find "hello" words in the text above. There is not spaces in this text.What can I do?
|
 |
Keith Lynn
Ranch Hand
Joined: Feb 07, 2005
Posts: 2341
|
|
String s = ... int index = s.indexOf("...");
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
Note that there is also an indexOf(str, fromIndex). So if the first occurrence is at index 7, for example, then you could find the next occurrence using indexOf("...", 8).
|
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
|
 |
Ekrem Altintas
Greenhorn
Joined: Dec 20, 2005
Posts: 14
|
|
|
Tahnks. It has worked
|
 |
 |
|
|
subject: How to find a word in a text file? (2)
|
|
|