So they would just be empty elements if the string being searched consisted entirely of substrings?
edit
Tried it, yes it does. So that makes it trivial code, but somehow it just seems wrong as a solution, creating a dummy list just to get a count? Can’t argue with how easy it is though.
edit #2
After a little more testing, you win. I ran a performance test with the split command vs my original version, with a 1 million character string of the letter "a", searching for "a". My version took 14.047 seconds, yours took 0.234 seconds 🤣 Not sure on the memory usage differences between those two though...
I'll change it on Rosetta when I get home tonight.
edit #3
done