Get number of occurrences of one string in another

Andrew Kluthe andrew at rjdfarm.com
Wed Feb 22 22:37:42 EST 2012


function substringCount pChar, pString
     put 0 into theCount
     repeat for each char theChar in pString
          if theChar is pChar then 
               add 1 to theCount
          end if
     end repeat
     return theCount
end substringCount


Would work out nicely if there is not built in function for this.

--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Get-number-of-occurrences-of-one-string-in-another-tp4412675p4412707.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list