Count occurrences of a substring: Difference between revisions
Count occurrences of a substring (view source)
Revision as of 10:43, 21 September 2023
, 8 months agoeasylang
VincentARM (talk | contribs) (add task to aarch64 assembly raspberry pi) |
(easylang) |
||
Line 1,368:
<pre>3
2</pre>
=={{header|EasyLang}}==
<syntaxhighlight lang="easylang">
func count str$ pat$ .
ind = 1
while ind + len pat$ - 1 <= len str$
if substr str$ ind len pat$ = pat$
cnt += 1
ind += len pat$
else
ind += 1
.
.
return cnt
.
print count "the three truths" "th"
print count "ababababab" "abab"
print count "11111111" "11"
print count "11111111" "12"
print count "12" "12"
</syntaxhighlight>
=={{header|EchoLisp}}==
|