Skip to content
Permalink
Browse files

Add Str.Lines/Words bool-only method

- makes Str.(lines|words).Bool O**0 (aka independent of size of string)
  • Loading branch information...
lizmat committed Sep 7, 2018
1 parent 86468e1 commit 070780e04f49715c94899b032ceaed650d88872c
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/core/Str.pm6
@@ -1347,6 +1347,9 @@ my class Str does Stringy { # declared in BOOTSTRAP
}
$seen
}
method bool-only(--> Bool:D) {
nqp::p6bool($!chars)
}
}
multi method lines(Str:D:) { Seq.new(Lines.new(self)) }

@@ -2217,6 +2220,9 @@ my class Str does Stringy { # declared in BOOTSTRAP
}
$seen
}
method bool-only(--> Bool:D) {
nqp::p6bool(nqp::islt_i($!pos,$!chars))
}
}
multi method words(Str:D:) { Seq.new(Words.new(self)) }

0 comments on commit 070780e

Please sign in to comment.
You can’t perform that action at this time.