How to find the offset of the last instance of a repeating character in a string? (Geoff Canyon)
Alex Tweedly
alex at tweedly.net
Fri Nov 2 22:44:30 EDT 2018
Oh dear - answering my own posts .... rarely a good sign :-)
On 03/11/2018 02:10, Alex Tweedly via use-livecode wrote:
>
> On 03/11/2018 00:43, Geoff Canyon via use-livecode wrote:
>> One thing I don't see how to do without significantly impacting
>> performance
>> is to return all offsets if there are overlapping strings. For example:
>>
>> allOffsets("aba","abababa")
>>
>> would return 1,5, when it might be reasonable to expect it to return
>> 1,3,5.
>> Using the offset function with numToSkip would make that easy; adapting
>> allOffsets to do so would be harder to do cleanly I think.
>>
> Can I suggest changing it to "someOffsets()" :-) :-)
>
> But seriously, can you not iteratively run "allofsets" ?
>
Answer : NO. That doesn't work.
However, there is a more efficient way that does work - but it needs to
be tested before I post it.
-- Alex.
More information about the use-livecode
mailing list