Count occurrences of a substring: Difference between revisions
Content added Content deleted
(→Tcl: Added implementation) |
(→{{header|Tcl}}: Demonstrate the lack of re-metachar problems) |
||
Line 33: | Line 33: | ||
} |
} |
||
puts [countSubstrings "the three truths" "th"] |
puts [countSubstrings "the three truths" "th"] |
||
puts [countSubstrings "ababababab" "abab"] |
puts [countSubstrings "ababababab" "abab"] |
||
puts [countSubstrings "abaabba*bbaba*bbab" "a*b"]</lang> |
|||
Output:<pre>3 |
Output:<pre>3 |
||
2 |
|||
2</pre> |
2</pre> |