• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is there a find method for strings?  RSS feed

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a find method for String or StringBuffer?
I am trying to find a certain substring in a bigger string...
Say I had
String HTMLStr = "<A HREF="bachelors.html" > Get Your Degree </A>";
is there a method for finding a substring like:
HTMLStr.find("html.\""); which returns a string value?
thanks,
Nick Ueda
 
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note sure what you mean about returning a String value; String.indexOf() returns the index of the substring, or -1 if not found.
If you're thinking about regular expressions, then look in the java.uti.regex package.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!