MatchText, MatchChunk and the needle in the haystack
Dave
dave at looktowindward.com
Mon Mar 19 13:34:31 EDT 2007
Hi,
Not 100% sure, but should you start from 1? e.g.
> put 0 into pos
should be:
put 1 into pos
All the Best
Dave
On 19 Mar 2007, at 17:24, Bryan McCormick wrote:
>
> -- note that i added a third param in case i need to "force" the
> routine to start elsewhere. it is set to 0 when i run this on the
> string in question (which by the way is about 5000 chars long)
>
> function makeOffsets mth,textBlock,posStart
> if posStart = empty then
> put 0 into pos
> else
> put posStart into pos
> end if
> repeat until varOffset = 0
> put offset(mth, textBlock, pos) into varOffset
> if varOffset <> 0 and varOffset <> posStart then
> if pos <> 0 then
> put pos&return after newText
> end if
> add varoffset+length(mth)+1 to pos
> else
> exit repeat
> end if
> end repeat
> return newText
> end makeOffsets
>
More information about the use-livecode
mailing list