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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the best way to search for a string in a string?
 
Similar Threads
Resize TextBox automatically in struts
Brainy Upload Bean.
Password checker (occurence)
Incorrect value of long calculation?
Convert Hex byte to ASCII