Sannyasin Brahmanathaswami wrote:
hhmm…. how do you
"truncate the string and
search from the beginning"
??

Can you give a code snippet example?

BR

I found this as well. Another thing, it's faster to truncate the string and
search from the beginning than using a "start at" on the entire string when
searching for all occurrences of a string .


-- Offset in place:
function Parse1 pStr, pSrc
  put 0 into tStart
  repeat
    put offset(pStr, pSrc, tStart) into tOS
    if tOS = 0 then exit repeat
    add tOS to tStart
    put tStart &cr after tOut
  end repeat
  return tOut
end Parse1


-- Delete as you go:
function Parse2 pStr, pSrc
  put 0 into tStart
  repeat
    put offset( pStr, pSrc) into tOS
    if tOS = 0 then exit repeat
    delete char 1 to tOS of pSrc
    add tOS to tStart
    put tStart &cr after tOut
  end repeat
  return tOut
end Parse2


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 ____________________________________________________________________
 ambassa...@fourthworld.com                http://www.FourthWorld.com

_______________________________________________
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