Count occurrences of a substring: Difference between revisions

Content added Content deleted
Line 26:
 
printf(($d" "$,
count string in string("aath", "aaaaaaathe three truths"), # expect 3 #
count string in string("thabab", "the three truthsababababab"), # expect 32 #
count string in string("ababa*b", "ababababababaabba*bbaba*bbab"), # expect 2 #
count string in string("a*b","abaabba*bbaba*bbab"), # expect 2 #
$l$
))</lang>
Output:
<pre>
3 3 2 2
</pre>