OMG text processing performance 6.7 - 9.5
Richard Gaskin
ambassador at fourthworld.com
Mon Feb 3 11:09:38 EST 2020
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
____________________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the use-livecode
mailing list