charIndex property

Bob Sneidar bobsneidar at iotecdigital.com
Fri Jul 28 17:35:14 EDT 2023


This is the essence on Livecode! This is why we love it! Shouldn’t we rebrand it? How about Lovecode?? …..

Never mind. 😂

Sent from my iPhone

> On Jul 28, 2023, at 04:55, Paul Dupuis via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> 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 at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


More information about the use-livecode mailing list