Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class StringSearch():
- def naiveSearch(self, text, substring):
- for i in range(0, len(text) - len(substring)):
- for j in range(0, len(substring)):
- print "text["+ str(i+j) + "]= " + text[i+j]
- print "substring[" + str(j) + "]= " + substring[j]
- if text[i +j] != substring[j]:
- break
- else:
- return i
- return -1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement