On Dec 9, 2011, at 2:31 PM, Bob Sneidar wrote:

> ... If you are trying to find ALL the "c"'s in the string it gets trickier....

For that, use this:

function offsets str,ctr
   -- returns a comma-delimited list of all the offsets of str in ctr
   put "" into offsetList
   put 0 into startPoint
   repeat
      put offset(str,ctr,startPoint) into os
      if os = 0 then exit repeat
      add os to startPoint
      put startPoint & "," after offsetList
   end repeat
   if char -1 of offsetList = "," then delete last char of mosList
   if offsetList = "" then return "0"
   return offsetList
end offsets

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to