Count occurrences of a substring: Difference between revisions
Content deleted Content added
+Stata |
|||
Line 2,202:
=={{header|Stata}}==
<lang stata>function strcount(s, x) {
n
k = 1-(i=strlen(x))
do {
if (k = ustrpos(s, x, k+
} while(k)
return(n)
Line 2,210 ⟶ 2,211:
strcount("peter piper picked a peck of pickled peppers", "pe")
5
strcount("ababababab","abab")
2</lang>
=={{header|TUSCRIPT}}==
|