@@ -1201,27 +1201,13 @@ L<Regex|/type/Regex> as a list of strings.
1201
1201
1202
1202
= head2 method contains
1203
1203
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.
1225
1211
1226
1212
= head2 routine index
1227
1213
@@ -1230,12 +1216,13 @@ Defined as:
1230
1216
multi sub index(Str(Cool) $s, Str:D $needle, Int(Cool) $startpos = 0 --> Int)
1231
1217
multi method index(Str(Cool) $needle, Int(Cool) $startpos = 0 --> Int)
1232
1218
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.
1237
1223
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.
1239
1226
1240
1227
= head2 routine rindex
1241
1228
0 commit comments