Skip to content

Commit 10ff0d6

Browse files
committed
Completes move fro Cool to Str
Leaving in Cool what it actually does, defer to Str. Closes #2303, if anyone has got any objection, please reopen and explain.
1 parent 1895af0 commit 10ff0d6

File tree

1 file changed

+13
-26
lines changed

1 file changed

+13
-26
lines changed

doc/Type/Cool.pod6

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,27 +1201,13 @@ L<Regex|/type/Regex> as a list of strings.
12011201
12021202
=head2 method contains
12031203
1204-
multi method contains(Cool:D: Str(Cool) $needle, Cool $start? --> Bool:D)
1205-
1206-
Coerces the invocant and first argument to L<C<Str>|/type/Str>, and
1207-
searches for C<$needle> in the string starting from C<$start> characters
1208-
into the string. Returns C<True> if C<$needle> is found. C<$start> is an
1209-
optional parameter, and if it's not present, C<contains> will search
1210-
from the beginning of the string.
1211-
1212-
say "Hello, World".contains('Hello'); # OUTPUT: «True␤»
1213-
say "Hello, World".contains('hello'); # OUTPUT: «False␤»
1214-
say "Hello, World".contains('Hello', 1); # OUTPUT: «False␤»
1215-
say "Hello, World".contains(','); # OUTPUT: «True␤»
1216-
say "Hello, World".contains(',', 3); # OUTPUT: «True␤»
1217-
say "Hello, World".contains(',', 10); # OUTPUT: «False␤»
1218-
1219-
In the third case, the C<'Hello'> string is not found since we have
1220-
started looking at the second position in it (index 1). Note that
1221-
because of how a L<List|/type/List> or L<Array|/type/Array> is
1222-
L<coerced|/type/List#method_Str> into a L<Str|/type/Str>, the results
1223-
may sometimes be surprising. See
1224-
L<traps|/language/traps#Lists_become_strings,_so_beware_.contains()>.
1204+
Defined as:
1205+
1206+
method contains(Cool:D: |c)
1207+
1208+
Coerces the invocant L<C<Str>|/type/Str>, and call
1209+
L<C<Str.contains>|/type/Str#routine_contains> on it. Please refer to it
1210+
for arguments and general syntax.
12251211
12261212
=head2 routine index
12271213
@@ -1230,12 +1216,13 @@ Defined as:
12301216
multi sub index(Str(Cool) $s, Str:D $needle, Int(Cool) $startpos = 0 --> Int)
12311217
multi method index(Str(Cool) $needle, Int(Cool) $startpos = 0 --> Int)
12321218
1233-
Coerces the first two arguments (in method form, also counting the invocant)
1234-
to L<Str|/type/Str>, and searches for C<$needle> in the string starting from C<$startpos>.
1235-
It returns the offset into the string where C<$needle> was found, and an undefined
1236-
value if it was not found.
1219+
Coerces the first two arguments (in method form, also counting the
1220+
invocant) to L<Str|/type/Str>, and searches for C<$needle> in the string
1221+
starting from C<$startpos>. It returns the offset into the string where
1222+
C<$needle> was found, and an undefined value if it was not found.
12371223
1238-
See L<the documentation in type Str|/type/Str#routine_index> for examples.
1224+
See L<the documentation in type Str|/type/Str#routine_index> for
1225+
examples.
12391226
12401227
=head2 routine rindex
12411228

0 commit comments

Comments
 (0)