Count occurrences of a substring: Difference between revisions
Count occurrences of a substring (view source)
Revision as of 10:47, 21 September 2023
, 9 months agoeasylang
(easylang) |
(easylang) |
||
Line 1,388:
print count "11111111" "12"
print count "12" "12"
</syntaxhighlight>
=={{header|EchoLisp}}==
<syntaxhighlight lang="scheme">
;; from Racket
(define count-substring
(compose length regexp-match*))
(count-substring "aab" "graabaabdfaabgh") ;; substring
→ 3
(count-substring "/ .e/" "Longtemps je me suis couché de bonne heure") ;; regexp
→ 4
</syntaxhighlight>
|