Count occurrences of a substring: Difference between revisions
m
→{{header|Raku}}: Fix-up some Perl6 -> Raku references
Thundergnat (talk | contribs) m (→{{header|Raku}}: Fix-up some Perl6 -> Raku references) |
|||
Line 2,052:
say count-substring(123123123,12); # 3</lang>
The <tt>~</tt> prefix operator converts <tt>$little</tt> to a <tt>Str</tt> if it isn't already, and <tt>.comb</tt> when given a <tt>Str</tt> as an argument returns instances of that substring. You can think of it as if the argument was a regex that matched the string literally <tt>/$little/</tt>. Also, prefix <tt>+</tt> forces numeric context in
=={{header|Red}}==
|