Filter

Peter M. Brigham, MD pmbrig at gmail.com
Fri Dec 9 15:09:01 EST 2011


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
pmbrig at gmail.com
http://home.comcast.net/~pmbrig





More information about the use-livecode mailing list