Multiple search of a substring in a string

After a bit of testing, I found out that my block runs into an infinite loop if you're searching for a single character, and that character is at the end. I fixed it by allowing the substring block to report an empty string if the start index is greater than the length of the string.

And just for good measure, here's a script of these blocks with fixed


And just cause, I decided to time the blocks as well.



(I used @dardoro's timing script)

I just realized something after 4+ years of snap that makes my block so much faster


I will update it soon for @loucheman

Probably not very fast, but recursive:

That only works in simple cases

And I don't imagine -1 is a defined use case (it might be but I'd personally avoid using it)

Oh, that’s really strange.

Thanks guys for your time, I'll do some testing

@sathvikrias: sorry about that:

I meant keep...

wait a minute, I made a faster version (of the thing with KEEP)
untitled script pic(32)

compilation split execution time by 2!

this new one?

also here is a VERY optimized version of my non-overlapping design:
untitled script pic(31)

Yeah, this one: you rock !

Thanks!

The final block:

Cool, but can you change overlap to a drop-down please

What's the point of making it a dropdown when it can just be a switch? If there were more options, then I'd understand having it be a menu.

I mean, it just looks sorta clunky with the parentheses, question Mark, long label, and Boolean.

Um the block still uses the old one

Sorry, this is the new version !


(I attach the reporter version of duration (Dardoro), with some improvements: run the script x times, report the average duration and also report the result)

It's a very big string: 489000 char

on my computer, your block (non-overlapping) run in 650ms
on my computer, bh block (overlapping) run in 2790ms

Do you wanna try to beat bh speed with the overtapping version ?

Ok I will try to make a faster version than