Skip to content

Commit e7bf359

Browse files
committed
Cool.index
1 parent c452935 commit e7bf359

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/Type/Cool.pod

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,18 @@ L<Regex|/type/Regex> as a list of strings.
710710
711711
say "6 or 12".comb(/\d+/).join(", "); # 6, 12
712712
713+
=head2 routine index
714+
715+
multi sub index(Str(Cool) $s, Str:D $needle, Int(Cool) $startpos = 0) returns Int
716+
multi method index(Str(Cool) $needle, Int(Cool) $startpos = 0) returns Int
717+
718+
Coerces the first two arguments (in method form, also counting the invocant)
719+
to L<Str|/type/Str>, and searches for C<$needle> in the string starting from C<$startpos>.
720+
It returns the offset into the string where C<$needle> was found, and an undefined
721+
value if it was not found.
722+
723+
See L<the documentation in type Str|/type/Str#routine index> for examples.
724+
713725
=head2 routine roots
714726
715727
multi method roots(Int(Cool) $n)
@@ -754,7 +766,7 @@ Coerces the invocant to L<IO::Path>.
754766
755767
TODO: sech, asech, cosech, acosech, cotanh, acotanh, cis,
756768
unpolar, fmt, substr-rw,
757-
trans, index, rindex,
769+
trans, rindex,
758770
match, subst, sprintf, printf, samecase,
759771
EVAL
760772

0 commit comments

Comments
 (0)