How can I find the total number of times a string occurs in a specific string? For example:
s = “abcabcd”
t = find occurrence of “d” in s
print(t) # Will output 1 because “d” appears only once while “a” appears twice."
Note:
I want to do this without any external devices(properties, loops, etc.), only solutions with block code are what I look for.
My problem can easily be solved utilizing a property and a counter, but those are “external-devices”, at least within my system(the trigger itself). I could also use loops, but I don’t want external-processing(events that occur outside of the system and that affect the system itself, loops usually require channels or other external events).
maybe I’m dum but it would be easier if you had a text property that set the value “abcabcd”, and then have another trigger use block code to find the occurence of d