Documentation for method contains

Documentation for method contains, assembled from the following types:

class Cool

From Cool

(Cool) method contains

multi method contains(Cool:D: Str(Cool$needleCool $start? --> Bool:D)

Coerces the invocant and first argument to Str, and searches for $needle in the string starting from $start. Returns True if $needle is found.

say "Hello, World".contains('Hello');      # OUTPUT: «True␤» 
say "Hello, World".contains('hello');      # OUTPUT: «False␤» 
say "Hello, World".contains(',');          # OUTPUT: «True␤» 
say "Hello, World".contains(','3);       # OUTPUT: «True␤» 
say "Hello, World".contains(','10);      # OUTPUT: «False␤» 

Note that because of how a List or Array is coerced into a Str, the results may sometimes be surprising. See traps.