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!

_______________________________________________
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