Jump to content

Count occurrences of a substring: Difference between revisions

m
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>
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.