File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -195,12 +195,14 @@ ASCII string: could not encode codepoint 222> will be issued.
195
195
196
196
= head2 routine index
197
197
198
- multi sub index(Cool $s, Str:D $needle, Cool $startpos = 0 --> Int)
199
- multi method index(Cool $needle, Cool $startpos = 0 --> Int)
198
+ multi method index(Str:D: Cool:D $needle --> Int:D)
199
+ multi method index(Str:D: Str:D $needle --> Int:D)
200
+ multi method index(Str:D: Cool:D $needle, Cool:D $pos --> Int:D)
201
+ multi method index(Str:D: Str:D $needle, Int:D $pos --> Int:D)
200
202
201
- Searches for C < $needle > in the string starting from C < $startpos > . It returns
202
- the offset into the string where C < $needle > was found, and C < Nil > if it was not
203
- found.
203
+ Searches for C < $needle > in the string starting from C < $pos > (if present) . It
204
+ returns the offset into the string where C < $needle > was found, and C < Nil > if it
205
+ was not found.
204
206
205
207
Examples:
206
208
@@ -212,6 +214,9 @@ Examples:
212
214
213
215
say index("Camelia is a butterfly", "Onion").defined ?? 'OK' !! 'NOT'; # OUTPUT: «NOT»
214
216
217
+ Other forms of index, including a sub, are
218
+ L < inherited from C < Cool > |/type/Cool#routine_index > . Check them there.
219
+
215
220
= head2 routine rindex
216
221
217
222
multi sub rindex(Str:D $haystack, Str:D $needle, Int $startpos = $haystack.chars --> Int)
You can’t perform that action at this time.
0 commit comments