*********************************** findNth(targetStr,inStr,n) *********************************** # By D@CC #on 2024BFeb19 #Used in pir2_CheckUp.py #searches for TargetStr in inStr # beginning at position beginN # finds the nth occurrence #returns pos of Nth occurance #returns -1 if not found # # WARNING only works for target Strings of length 1 # beginN=0 countDown=n posN=beginN #start searching at column beginN while countDown>0: countDown=countDown-1 if posN==-1 : return -1 else: #print("countDown",countDown,"colN:",posN) posN=inStr.find(targetStr,posN)+1 #print(" found it in colN:",posN) #end if #end while return posN #end def ********************************************************* #/findNth.txt