Guest User

Untitled

a guest
Feb 14th, 2012
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. global pointer
  2. def countSubStringMatchRecursive(target1,key):
  3.     count=0
  4.     #pointer=0
  5.     print 'Parent String',target1
  6.     print 'Match key',key
  7.     pointer=subrecfn(target1,key) # returns the pointer of the last match.
  8.     if pointer!=-1:
  9.         count+=1
  10.         target1= target1[pointer:]
  11.         subrecfn(target1,key)
  12.     else:
  13.         print 'No more matches!'
  14.         break
  15.     print 'Total count',count
  16.    
  17.    
  18.    
  19.    
  20.    
  21.    
  22. def subrecfn(target,key):
  23.     #int pointer## Is this valid in Python, if yes then the function isnt necessary!
  24.     pointer=find(target,key)
  25.     return pointer
Advertisement
Add Comment
Please, Sign In to add comment