Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Includes new form of contains
Also clarifies haystack metaphor. @lizmat changed this very recently,
it's likely that it's not really done that way in the current version,
but it matches roast, and over all, it closes #2334. Thanks!
  • Loading branch information
JJ committed Jan 12, 2019
1 parent 8a7b0a0 commit 23fb530
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions doc/Type/Str.pod6
Expand Up @@ -45,19 +45,19 @@ Examples:
Defined as:
multi method contains(Str:D: Cool:D $needle)
multi method contains(Str:D: Str:D $needle)
multi method contains(Str:D: Cool:D $needle, Int(Cool:D) $pos)
multi method contains(Str:D: Str:D $needle, Int:D $pos)
Coerces the invocant (represented in the signature by C<Str:D:> and
first argument (which we are calling C<$needle>) to L<C<Str>|/type/Str>
(if it's not already, that is, the first and third C<multi>), and
searches for C<$needle> in the string starting from C<$pos> characters
into the string. Returns C<True> if C<$needle> is found. C<$pos> is an
optional parameter, and if it's not present, C<contains> will search
from the beginning of the string (using the first two forms of the
C<multi>).
multi method contains(Str:D: Cool:D $needle --> Bool:D)
multi method contains(Str:D: Str:D $needle --> Bool:D)
multi method contains(Str:D: Cool:D $needle, Int(Cool:D) $pos --> Bool:D)
multi method contains(Str:D: Str:D $needle, Int:D $pos --> Bool:D)
Coerces the invocant (represented in the signature by C<Str:D:>, that would be
the I<haystack>) and first argument (which we are calling C<$needle>) to
L<C<Str>|/type/Str> (if it's not already, that is, in the first and third
C<multi> forms), and searches for C<$needle> in the invocant (or I<haystack>)
starting from C<$pos> characters into the string, if that is included as an
argument. Returns C<True> if C<$needle> is found. C<$pos> is an optional
parameter, and if it's not present, C<contains> will search from the beginning
of the string (using the first two forms of the C<multi>).
say <Hello, World>.contains('Hello', 0); # OUTPUT: «True␤»
say "Hello, World".contains('Hello'); # OUTPUT: «True␤»
Expand Down Expand Up @@ -1434,4 +1434,4 @@ C<Numeric>.
=end pod

# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

0 comments on commit 23fb530

Please sign in to comment.