aspose file tools*
The moose likes Beginning Java and the fly likes What is the best way to search for a string in a string? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is the best way to search for a string in a string?" Watch "What is the best way to search for a string in a string?" New topic
Author

What is the best way to search for a string in a string?

Sri Nivas
Ranch Hand

Joined: Apr 18, 2001
Posts: 58
What I am planning to do is to find a string (one word or multiple words separated by space) in a bigger string. The bigger string can be the body in an e-mail and the string to be searched may be a keyword or a particular string.
Is using 'indexOf' is the only option or is there any other way to do this, so that the code will be faster to execute?
Srini.
Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
take a look at the class called StringTokenizer it's located in Util package.


Val SCJP <BR>going for SCJD
 
Don't get me started about those stupid light bulbs.
 
subject: What is the best way to search for a string in a string?