Count occurrences of a substring: Difference between revisions
Content deleted Content added
No edit summary |
m →{{header|Ruby}}: Stop using Array#count, because it needs Ruby 1.8.7. |
||
Line 422:
=={{header|Ruby}}==
<lang ruby>irb(main):001:0> "the three truths".scan("th").
=> 3
irb(main):002:0> "ababababab".scan("abab").
=> 2</lang>
String#scan returns an array of substrings, and Array#
=={{header|SNOBOL4}}==
|