*
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 Android Security Essentials Live Lessons this week in the Android 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: What is the best way to search for a string in a string?
 
Similar Threads
Convert Hex byte to ASCII
Password checker (occurence)
Resize TextBox automatically in struts
Brainy Upload Bean.
Incorrect value of long calculation?