Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
introduce has-substr method to access nqp::eqat
  • Loading branch information
TimToady committed Apr 3, 2015
1 parent d4fd249 commit 049020f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/Cool.pm
Expand Up @@ -133,6 +133,15 @@ my class Cool { # declared in BOOTSTRAP
}
method trans(*@a) { self.Str.trans(@a) }

proto method has-substr(|) {*}
multi method has-substr(Cool $needle, Cool $pos = 0) {
?nqp::eqat(
nqp::unbox_s(self.Str),
nqp::unbox_s($needle.Str),
nqp::unbox_i($pos.Int)
);
}

proto method index(|) {*}
multi method index(Cool $needle, Cool $pos = 0) {
my int $result = nqp::index(
Expand Down

0 comments on commit 049020f

Please sign in to comment.