Skip to content

Commit

Permalink
Cosmetic changes to Str.ends-with
Browse files Browse the repository at this point in the history
To use same variable names and same style as e.g. starts-with.  No
functinal changes, nor any performance difference.
  • Loading branch information
lizmat committed Dec 11, 2019
1 parent b569e11 commit f9e30a0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core.c/Str.pm6
Expand Up @@ -141,13 +141,13 @@ my class Str does Stringy { # declared in BOOTSTRAP
nqp::hllbool(nqp::eqat(self, $needle, 0))
}

multi method ends-with(Str:D: Cool:D $suffix --> Bool:D) {
self.ends-with: $suffix.Str
multi method ends-with(Str:D: Cool:D $needle --> Bool:D) {
self.ends-with: $needle.Str
}
multi method ends-with(Str:D: Str:D $suffix --> Bool:D) {
multi method ends-with(Str:D: Str:D $needle --> Bool:D) {
nqp::hllbool(
nqp::eqat(
$!value,$suffix,nqp::sub_i(nqp::chars($!value),nqp::chars($suffix))
self,$needle,nqp::sub_i(nqp::chars(self),nqp::chars($needle))
)
)
}
Expand Down

0 comments on commit f9e30a0

Please sign in to comment.