• Post Reply Bookmark Topic Watch Topic
  • New Topic

What is the pattern matching algorithm used in functions like indexOf  RSS feed

 
karthick Soundararaj
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
I did some googling but i am not able to figure what pattern matching algorithm is being used in Java. Anyone has any idea about the pattern matching algorithm being used?
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The source code for the String class is in the JDK in a file called src.zip. Just unzip the file and take a look at the source yourself. If I had to guess, I would say that it is just a loop to traverse the string to be searched, with an inner loop to match the string to search for.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!