Count occurrences of a substring: Difference between revisions

(Added solution for Action!)
Line 3,002:
2
2</pre>
 
=={{header|Transd}}==
<lang scheme>#lang transd
 
MainModule: {
countSubstring: (λ s String() sub String()
(with n 0 pl 0
(while (> (= pl (find s sub pl)) -1)
(+= pl (size sub)) (+= n 1))
(lout n))
),
_start: (λ
(countSubstring "the three truths" "th")
(countSubstring "ababababab" "abab")
)
}</lang>{{out}}
<pre>
3
2
</pre>
 
=={{header|TUSCRIPT}}==
111

edits