Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
implement limit for Str.comb
  • Loading branch information
moritz committed Jul 24, 2011
1 parent 0376f99 commit b6150b2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/Str.pm
Expand Up @@ -242,10 +242,10 @@ my class Str does Stringy {
multi method comb() {
(^self.chars).map({self.substr($_, 1) });
}
multi method comb(Regex $pat, :$match) {
multi method comb(Regex $pat, $limit = $Inf, :$match) {
$match
?? self.match(:g, $pat)
!! self.match(:g, $pat).map: { .Str }
?? self.match(:g, :x(1..$limit), $pat)
!! self.match(:g, :x(1..$limit), $pat).map: { .Str }
}


Expand Down

0 comments on commit b6150b2

Please sign in to comment.