Count occurrences of a substring: Difference between revisions
Content added Content deleted
(easylang) |
|||
Line 1,388: | Line 1,388: | ||
print count "11111111" "12" |
print count "11111111" "12" |
||
print count "12" "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> |
</syntaxhighlight> |
||