Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sri Nivas
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 439
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
take a look at the class called StringTokenizer it's located in Util package.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic