charIndex property

Paul Dupuis paul at researchware.com
Fri Jul 28 07:54:31 EDT 2023


On 7/27/2023 5:06 PM, Mark Waddingham via use-livecode wrote:
> Oh those pesky chunks which don’t ‘cover’ the target string (which is actually all of them except codeunit/point/char come to think of it). I should have run through a few more examples in my head before posting….
>
> Alternative attempt:
>
> Put null into word N to -1 of S
> Delete codeunit (codeunitoffset(null, S) to -1 of S
> Return the number of chars in S + 1
>
> The problem before was the chars which do not form part of the last chunk and remain after deletion.
>
> The above puts in a sentinel char which can be searched for to find where the requested chunk started.
>
> Second time lucky? ;)
>
>

Second time's the charm. That works for all chunk types tested 
(trueWord, sentence, paragraph)! Thank you!



More information about the use-livecode mailing list