txt: ## cool.md
  ## Chunk 2 of 3
  Mnemonic: returns an ordinal number
  
  ## [method path](#class_Cool "go to top of document")[§](#method_path "direct link")
  
  ```raku
  method path(Cool:D: --> IO::Path:D)
  ```
  
  **DEPRECATED**. *It's been deprecated as of the 6.d version. Will be removed in the next ones.*
  
  Stringifies the invocant and converts it to [`IO::Path`](/type/IO/Path) object. Use the [`.IO method`](/routine/IO) instead.
  
  ## [routine chr](#class_Cool "go to top of document")[§](#routine_chr "direct link")
  
  ```raku
  sub chr(Int(Cool))
  method chr()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Int`](/type/Int), interprets it as a [Unicode code points](https://en.wikipedia.org/wiki/Code_point), and returns a [`Str`](/type/Str) made of that code point.
  
  ```raku
  say '65'.chr;       # OUTPUT: «A␤»
  ```
  
  The inverse operation is [ord](/routine/ord).
  
  Mnemonic: turns an integer into a *char*acter.
  
  ## [routine chars](#class_Cool "go to top of document")[§](#routine_chars "direct link")
  
  ```raku
  multi  chars(Cool $x)
  multi  chars(Str:D $x)
  multi  chars(str $x --> int)
  method chars(--> Int:D)
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Str`](/type/Str), and returns the number of characters in the string. Please note that on the JVM, you currently get codepoints instead of graphemes.
  
  ```raku
  say 'møp'.chars;    # OUTPUT: «3␤»
  say 'ã̷̠̬̊'.chars;     # OUTPUT: «1␤»
  say '👨‍👩‍👧‍👦🏿'.chars;    # OUTPUT: «1␤»
  ```
  
  If the string is native, the number of chars will be also returned as a native `int`.
  
  Graphemes are user visible characters. That is, this is what the user thinks of as a “character”.
  
  Graphemes can contain more than one codepoint. Typically the number of graphemes and codepoints differs when `Prepend` or `Extend` characters are involved (also known as [Combining characters](https://en.wikipedia.org/wiki/Combining_character)), but there are many other cases when this may happen. Another example is `\c[ZWJ]` ([Zero-width joiner](https://en.wikipedia.org/wiki/Zero-width_joiner)).
  
  You can check `Grapheme_Cluster_Break` property of a character in order to see how it is going to behave:
  
  ```raku
  say ‘ã̷̠̬̊’.uniprops(‘Grapheme_Cluster_Break’); # OUTPUT: «(Other Extend Extend Extend Extend)␤»
  say ‘👨‍👩‍👧‍👦🏿’.uniprops(‘Grapheme_Cluster_Break’); # OUTPUT: «(E_Base_GAZ ZWJ E_Base_GAZ ZWJ E_Base_GAZ ZWJ E_Base_GAZ E_Modifier)␤»
  ```
  
  You can read more about graphemes in the [Unicode Standard](https://unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries), which Raku tightly follows, using a method called [NFG, normal form graphemes](/language/glossary#NFG) for efficiently representing them.
  
  ## [routine codes](#class_Cool "go to top of document")[§](#routine_codes "direct link")
  
  ```raku
  sub codes(Str(Cool))
  method codes()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Str`](/type/Str), and returns the number of [Unicode code points](https://en.wikipedia.org/wiki/Code_point).
  
  ```raku
  say 'møp'.codes;    # OUTPUT: «3␤»
  ```
  
  The same result will be obtained with
  
  ```raku
  say +'møp'.ords;    # OUTPUT: «3␤»
  ```
  
  [ords](/routine/ords) first obtains the actual codepoints, so there might be a difference in speed.
  
  ## [routine flip](#class_Cool "go to top of document")[§](#routine_flip "direct link")
  
  ```raku
  sub flip(Cool $s --> Str:D)
  method flip()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Str`](/type/Str), and returns a reversed version.
  
  ```raku
  say 421.flip;       # OUTPUT: «124␤»
  ```
  
  ## [routine trim](#class_Cool "go to top of document")[§](#routine_trim "direct link")
  
  ```raku
  sub trim(Str(Cool))
  method trim()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Str`](/type/Str), and returns the string with both leading and trailing whitespace stripped.
  
  ```raku
  my $stripped = '  abc '.trim;
  say "<$stripped>";          # OUTPUT: «<abc>␤»
  ```
  
  ## [routine trim-leading](#class_Cool "go to top of document")[§](#routine_trim-leading "direct link")
  
  ```raku
  sub trim-leading(Str(Cool))
  method trim-leading()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Str`](/type/Str), and returns the string with leading whitespace stripped.
  
  ```raku
  my $stripped = '  abc '.trim-leading;
  say "<$stripped>";          # OUTPUT: «<abc >␤»
  ```
  
  ## [routine trim-trailing](#class_Cool "go to top of document")[§](#routine_trim-trailing "direct link")
  
  ```raku
  sub trim-trailing(Str(Cool))
  method trim-trailing()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Str`](/type/Str), and returns the string with trailing whitespace stripped.
  
  ```raku
  my $stripped = '  abc '.trim-trailing;
  say "<$stripped>";          # OUTPUT: «<  abc>␤»
  ```
  
  ## [routine lc](#class_Cool "go to top of document")[§](#routine_lc "direct link")
  
  ```raku
  sub lc(Str(Cool))
  method lc()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Str`](/type/Str), and returns it case-folded to lowercase.
  
  ```raku
  say "ABC".lc;       # OUTPUT: «abc␤»
  ```
  
  ## [routine uc](#class_Cool "go to top of document")[§](#routine_uc "direct link")
  
  ```raku
  sub uc(Str(Cool))
  method uc()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Str`](/type/Str), and returns it case-folded to uppercase (capital letters).
  
  ```raku
  say "Abc".uc;       # OUTPUT: «ABC␤»
  ```
  
  ## [routine fc](#class_Cool "go to top of document")[§](#routine_fc "direct link")
  
  ```raku
  sub fc(Str(Cool))
  method fc()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Str`](/type/Str), and returns the result a Unicode "case fold" operation suitable for doing caseless string comparisons. (In general, the returned string is unlikely to be useful for any purpose other than comparison.)
  
  ```raku
  say "groß".fc;       # OUTPUT: «gross␤»
  ```
  
  ## [routine tc](#class_Cool "go to top of document")[§](#routine_tc "direct link")
  
  ```raku
  sub tc(Str(Cool))
  method tc()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Str`](/type/Str), and returns it with the first letter case-folded to titlecase (or where not available, uppercase).
  
  ```raku
  say "abC".tc;       # OUTPUT: «AbC␤»
  ```
  
  ## [routine tclc](#class_Cool "go to top of document")[§](#routine_tclc "direct link")
  
  ```raku
  sub tclc(Str(Cool))
  method tclc()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Str`](/type/Str), and returns it with the first letter case-folded to titlecase (or where not available, uppercase), and the rest of the string case-folded to lowercase.
  
  ```raku
  say 'abC'.tclc;     # OUTPUT: «Abc␤»
  ```
  
  ## [routine wordcase](#class_Cool "go to top of document")[§](#routine_wordcase "direct link")
  
  ```raku
  sub wordcase(Str(Cool) $input, :&filter = &tclc, Mu :$where = True)
  method wordcase(:&filter = &tclc, Mu :$where = True)
  ```
  
  Coerces the invocant (or in sub form, the first argument) to [`Str`](/type/Str), and filters each word that smartmatches against `$where` through the `&filter`. With the default filter (first character to uppercase, rest to lowercase) and matcher (which accepts everything), this titlecases each word:
  
  ```raku
  say "raku programming".wordcase;        # OUTPUT: «Raku Programming␤»
  ```
  
  With a matcher:
  
  ```raku
  say "have fun working on raku".wordcase(:where({ .chars > 3 }));
                                          # Have fun Working on Raku
  ```
  
  With a customer filter too:
  
  ```raku
  say "have fun working on raku".wordcase(:filter(&uc), :where({ .chars > 3 }));
                                          # HAVE fun WORKING on RAKU
  ```
  
  ## [routine samecase](#class_Cool "go to top of document")[§](#routine_samecase "direct link")
  
  ```raku
  sub samecase(Cool $string, Cool $pattern)
  method samecase(Cool:D: Cool $pattern)
  ```
  
  Coerces the invocant (or in sub form, the first argument) to [`Str`](/type/Str), and calls [`Str.samecase`](/type/Str#method_samecase) on it.
  
  ```raku
  say "raKu".samecase("A_a_"); # OUTPUT: «Raku␤»
  say "rAKU".samecase("Ab");   # OUTPUT: «Raku␤»
  ```
  
  ## [routine uniprop](#class_Cool "go to top of document")[§](#routine_uniprop "direct link")
  
  ```raku
  multi        uniprop(Str:D, |c)
  multi        uniprop(Int:D $code)
  multi        uniprop(Int:D $code, Stringy:D $propname)
  multi method uniprop(|c)
  ```
  
  Returns the [unicode property](https://en.wikipedia.org/wiki/Unicode_character_property) of the first character. If no property is specified returns the [General Category](https://en.wikipedia.org/wiki/Unicode_character_property#General_Category). Returns a Bool for Boolean properties. A [uniprops](/routine/uniprops) routine can be used to get the property for every character in a string.
  
  ```raku
  say 'a'.uniprop;               # OUTPUT: «Ll␤»
  say '1'.uniprop;               # OUTPUT: «Nd␤»
  say 'a'.uniprop('Alphabetic'); # OUTPUT: «True␤»
  say '1'.uniprop('Alphabetic'); # OUTPUT: «False␤»
  ```
  
  ## [sub uniprops](#class_Cool "go to top of document")[§](#sub_uniprops "direct link")
  
  ```raku
  sub uniprops(Str:D $str, Stringy:D $propname = "General_Category")
  ```
  
  Interprets the invocant as a [`Str`](/type/Str), and returns the [unicode property](http://userguide.icu-project.org/strings/properties) for each character as a Seq. If no property is specified returns the [General Category](https://en.wikipedia.org/wiki/Unicode_character_property#General_Category). Returns a Bool for Boolean properties. Similar to [uniprop](/routine/uniprop), but for each character in the passed string.
  
  ## [routine uniname](#class_Cool "go to top of document")[§](#routine_uniname "direct link")
  
  ```raku
  sub uniname(Str(Cool) --> Str)
  method uniname(--> Str)
  ```
  
  Interprets the invocant or first argument as a [`Str`](/type/Str), and returns the Unicode codepoint name of the first codepoint of the first character. See [uninames](/routine/uninames) for a routine that works with multiple codepoints, and [uniparse](/routine/uniparse) for the opposite direction.
  
  ```raku
  # Camelia in Unicode
  say ‘»ö«’.uniname;
  # OUTPUT: «RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK␤»
  say "Ḍ̇".uniname; # Note, doesn't show "COMBINING DOT ABOVE"
  # OUTPUT: «LATIN CAPITAL LETTER D WITH DOT BELOW␤»
  
  # Find the char with the longest Unicode name.
  say (0..0x1FFFF).sort(*.uniname.chars)[*-1].chr.uniname;
  # OUTPUT: «BOX DRAWINGS LIGHT DIAGONAL UPPER CENTRE TO MIDDLE RIGHT AND MIDDLE LEFT TO LOWER CENTRE␤»
  ```
  
  Available as of the 2021.04 Rakudo compiler release.
  
  ## [routine uninames](#class_Cool "go to top of document")[§](#routine_uninames "direct link")
  
  ```raku
  sub uninames(Str:D)
  method uninames()
  ```
  
  Returns of a [`Seq`](/type/Seq) of Unicode names for the all the codepoints in the [`Str`](/type/Str) provided.
  
  ```raku
  say ‘»ö«’.uninames.raku;
  # OUTPUT: «("RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK", "LATIN SMALL LETTER O WITH DIAERESIS", "LEFT-POINTING DOUBLE ANGLE QUOTATION MARK").Seq␤»
  ```
  
  Note this example, which gets a [`Seq`](/type/Seq) where each element is a [`Seq`](/type/Seq) of all the codepoints in that character.
  
  ```raku
  say "Ḍ̇'oh".comb>>.uninames.raku;
  # OUTPUT: «(("LATIN CAPITAL LETTER D WITH DOT BELOW", "COMBINING DOT ABOVE").Seq, ("APOSTROPHE",).Seq, ("LATIN SMALL LETTER O",).Seq, ("LATIN SMALL LETTER H",).Seq)␤»
  ```
  
  See [uniname](/routine/uniname) for the name of the first codepoint of the first character in the provided [`Str`](/type/Str) and [uniparse](/routine/uniparse) for the opposite direction.
  
  ## [routine unimatch](#class_Cool "go to top of document")[§](#routine_unimatch "direct link")
  
  ```raku
  multi unimatch(Str:D $str, |c)
  multi unimatch(Int:D $code, Stringy:D $pvalname, Stringy:D $propname = $pvalname)
  ```
  
  Checks if the given integer codepoint or the first letter of the given string has a unicode property equal to the value you give. If you supply the Unicode property to be checked it will only return True if that property matches the given value.
  
  ```raku
  say unimatch 'A', 'Latin';           # OUTPUT: «True␤»
  say unimatch 'A', 'Latin', 'Script'; # OUTPUT: «True␤»
  say unimatch 'A', 'Ll';              # OUTPUT: «False␤»
  ```
  
  The last property corresponds to "lowercase letter", which explains why it returns false.
  
  ## [routine chop](#class_Cool "go to top of document")[§](#routine_chop "direct link")
  
  ```raku
  sub chop(Str(Cool))
  method chop()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Str`](/type/Str), and returns it with the last character removed.
  
  ```raku
  say 'raku'.chop;                        # OUTPUT: «rak␤»
  ```
  
  ## [routine chomp](#class_Cool "go to top of document")[§](#routine_chomp "direct link")
  
  ```raku
  sub chomp(Str(Cool))
  method chomp()
  ```
  
  Coerces the invocant (or in sub form, its argument) to [`Str`](/type/Str), and returns it with the last character removed, if it is a logical newline.
  
  ```raku
  say 'ab'.chomp.chars;                   # OUTPUT: «2␤»
  say "a\n".chomp.chars;                  # OUTPUT: «1␤»
  ```
  
  ## [routine substr](#class_Cool "go to top of document")[§](#routine_substr "direct link")
  
  ```raku
  sub substr(Str(Cool) $str, |c)
  method substr(|c)
  ```
  
  Coerces the invocant (or in the sub form, the first argument) to [`Str`](/type/Str), and calls [Str.substr](/type/Str#routine_substr) with the arguments.
  
  ## [routine substr-rw](#class_Cool "go to top of document")[§](#routine_substr-rw "direct link")
  
  ```raku
  multi method substr-rw(|) is rw
  multi        substr-rw(|) is rw
  ```
  
  Coerces the invocant (or in the sub form, the first argument) to [`Str`](/type/Str), and calls [Str.substr-rw](/type/Str#method_substr-rw) with the arguments.
  
  ## [routine ords](#class_Cool "go to top of document")[§](#routine_ords "direct link")
  
  ```raku
  sub ords(Str(Cool) $str)
  method ords()
  ```
  
  Coerces the invocant (or in the sub form, the first argument) to [`Str`](/type/Str), and returns a list of Unicode codepoints for each character.
  
  ```raku
  say "Camelia".ords;              # OUTPUT: «67 97 109 101 108 105 97␤»
  say ords 10;                     # OUTPUT: «49 48␤»
  ```
  
  This is the list-returning version of [ord](/routine/ord). The inverse operation in [chrs](/routine/chrs). If you are only interested in the number of codepoints, [codes](/routine/codes) is a possibly faster option.
  
  ## [routine chrs](#class_Cool "go to top of document")[§](#routine_chrs "direct link")
  
  ```raku
  sub chrs(*@codepoints --> Str:D)
  method chrs()
  ```
  
  Coerces the invocant (or in the sub form, the argument list) to a list of integers, and returns the string created by interpreting each integer as a Unicode codepoint, and joining the characters.
  
  ```raku
  say <67 97 109 101 108 105 97>.chrs;   # OUTPUT: «Camelia␤»
  ```
  
  This is the list-input version of [chr](/routine/chr). The inverse operation is [ords](/routine/ords).
  
  ## [routine split](#class_Cool "go to top of document")[§](#routine_split "direct link")
  
  ```raku
  multi        split(  Str:D $delimiter, Str(Cool) $input, $limit = Inf, :$k, :$v, :$kv, :$p, :$skip-empty)
  multi        split(Regex:D $delimiter, Str(Cool) $input, $limit = Inf, :$k, :$v, :$kv, :$p, :$skip-empty)
  multi        split(@delimiters, Str(Cool) $input, $limit = Inf, :$k, :$v, :$kv, :$p, :$skip-empty)
  multi method split(  Str:D $delimiter, $limit = Inf, :$k, :$v, :$kv, :$p, :$skip-empty)
  multi method split(Regex:D $delimiter, $limit = Inf, :$k, :$v, :$kv, :$p, :$skip-empty)
  multi method split(@delimiters, $limit = Inf, :$k, :$v, :$kv, :$p, :$skip-empty)
  ```
  
  [[1]](#fn1)
  
  Coerces the invocant (or in the sub form, the second argument) to [`Str`](/type/Str), splits it into pieces based on delimiters found in the string and returns the result as a [`Seq`](/type/Seq).
  
  If `$delimiter` is a string, it is searched for literally and not treated as a regex. You can also provide multiple delimiters by specifying them as a list, which can mix `Cool` and [`Regex`](/type/Regex) objects.
  
  ```raku
  say split(';', "a;b;c").raku;               # OUTPUT: «("a", "b", "c").Seq␤»
  say split(';', "a;b;c", 2).raku;            # OUTPUT: «("a", "b;c").Seq␤»
  
  say split(';', "a;b;c,d").raku;             # OUTPUT: «("a", "b", "c,d").Seq␤»
  say split(/\;/, "a;b;c,d").raku;            # OUTPUT: «("a", "b", "c,d").Seq␤»
  say split(/<[;,]>/, "a;b;c,d").raku;        # OUTPUT: «("a", "b", "c", "d").Seq␤»
  
  say split(['a', /b+/, 4], '1a2bb345').raku; # OUTPUT: «("1", "2", "3", "5").Seq␤»
  ```
  
  By default, `split` omits the matches, and returns a list of only those parts of the string that did not match. Specifying one of the `:k, :v, :kv, :p` adverbs changes that. Think of the matches as a list that is interleaved with the non-matching parts.
  
  The `:v` interleaves the values of that list, which will be either [`Match`](/type/Match) objects, if a [`Regex`](/type/Regex) was used as a matcher in the split, or [`Str`](/type/Str) objects, if a `Cool` was used as matcher. If multiple delimiters are specified, [`Match`](/type/Match) objects will be generated for all of them, unless **all** of the delimiters are `Cool`.
  
  ```raku
  say 'abc'.split(/b/, :v);               # OUTPUT: «(a ｢b｣ c)␤»
  say 'abc'.split('b', :v);               # OUTPUT: «(a b c)␤»
  ```
  
  `:k` interleaves the keys, that is, the indexes:
  
  ```raku
  say 'abc'.split(/b/, :k);               # OUTPUT: «(a 0 c)␤»
  ```
  
  `:kv` adds both indexes and matches:
  
  ```raku
  say 'abc'.split(/b/, :kv);               # OUTPUT: «(a 0 ｢b｣ c)␤»
  ```
  
  and `:p` adds them as [`Pair`](/type/Pair)s, using the same types for values as `:v` does:
  
  ```raku
  say 'abc'.split(/b/, :p);               # OUTPUT: «(a 0 => ｢b｣ c)␤»
  say 'abc'.split('b', :p);               # OUTPUT: «(a 0 => b c)␤»
  ```
  
  You can only use one of the `:k, :v, :kv, :p` adverbs in a single call to `split`.
  
  Note that empty chunks are not removed from the result list. For that behavior, use the `:skip-empty` named argument:
  
  ```raku
  say ("f,,b,c,d".split: /","/             ).raku;  # OUTPUT: «("f", "", "b", "c", "d").Seq␤»
  say ("f,,b,c,d".split: /","/, :skip-empty).raku;  # OUTPUT: «("f", "b", "c", "d").Seq␤»
  ```
  
  ## [routine lines](#class_Cool "go to top of document")[§](#routine_lines "direct link")
  
  ```raku
  sub lines(Str(Cool))
  method lines()
  ```
  
  Coerces the invocant (and in sub form, the argument) to [`Str`](/type/Str), decomposes it into lines (with the newline characters stripped), and returns the list of lines.
  
  ```raku
  say lines("a\nb\n").join('|');          # OUTPUT: «a|b␤»
  say "some\nmore\nlines".lines.elems;    # OUTPUT: «3␤»
  ```
  
  This method can be used as part of an [`IO::Path`](/type/IO/Path) to process a file line-by-line, since [`IO::Path`](/type/IO/Path) objects inherit from `Cool`, e.g.:
  
  ```raku
  for 'huge-csv'.IO.lines -> $line {
      # Do something with $line
  }
  
  # or if you'll be processing later
  my @lines = 'huge-csv'.IO.lines;
  
  ```
  
  Without any arguments, sub `lines` operates on [`$*ARGFILES`](/language/variables#$*ARGFILES).
  
  To modify values in place use [`is copy`](/language/signatures#Parameter_traits_and_modifiers) to force a writable container.
  
  ```raku
  for $*IN.lines -> $_ is copy { s/(\w+)/{$0 ~ $0}/; .say }
  
  ```
  
  ## [method words](#class_Cool "go to top of document")[§](#method_words "direct link")
  
  ```raku
  method words(Cool:D: |c)
  ```
  
  Coerces the invocant (or first argument, if it is called as a subroutine) to [`Str`](/type/Str), and returns a list of words that make up the string. Check [`Str.words`](/type/Str#routine_words) for additional arguments and its meaning.
  
  ```raku
  say <The quick brown fox>.words.join('|');     # OUTPUT: «The|quick|brown|fox␤»
  say <The quick brown fox>.words(2).join('|');  # OUTPUT: «The|quick␤»
  
  ```
  
  `Cool` is the base class for many other classes, and some of them, like [`Match`](/type/Match), can be converted to a string. This is what happens in this case:
  
  ```raku
  say ( "easy come, easy goes" ~~ m:g/(ea\w+)/).words(Inf);
  # OUTPUT: «(easy easy)␤»
  say words( "easy come, easy goes" ~~ m:g/(ea\w+)/ , ∞);
  # OUTPUT: «(easy easy)␤»
  ```
  
  The example above illustrates two of the ways `words` can be invoked, with the first argument turned into invocant by its signature. `Inf` is the default value of the second argument, so in both cases (and forms) it can be simply omitted.
  
  Only whitespace (including no-break space) counts as word boundaries
  
  ```raku
  say <Flying on a Boeing 747>.words.join('|');  # OUTPUT: «Flying|on|a|Boeing|747␤»
  ```
  
  In this case, "Boeing 747" includes a (visible only in the source) no-break space; `words` still splits the (resulting) [`Str`](/type/Str) on it, even if the original array only had 4 elements:
  
  ```raku
  say <Flying on a Boeing 747>.join('|');        # OUTPUT: «Flying|on|a|Boeing 747␤»
  ```
  
  Please see [`Str.words`](/type/Str#routine_words) for more examples and ways to invoke it.
  
  ## [routine comb](#class_Cool "go to top of document")[§](#routine_comb "direct link")
  
  ```raku
  multi        comb(Regex $matcher, Cool $input, $limit = *)
  multi        comb(Str $matcher, Cool $input, $limit = *)
  multi        comb(Int:D $size, Cool $input, $limit = *)
  multi method comb(|c)
  ```
  
  Returns a [`Seq`](/type/Seq) of all (or if supplied, at most `$limit`) matches of the invocant (method form) or the second argument (sub form) against the [`Regex`](/type/Regex), string or defined number.
  
  ```raku
  say "6 or 12".comb(/\d+/).join(", ");           # OUTPUT: «6, 12␤»
  say comb(/\d <[1..9]> /,(11..30)).join("--");
  # OUTPUT:
  # «11--12--13--14--15--16--17--18--19--21--22--23--24--25--26--27--28--29␤»
  ```
  
  The second statement exemplifies the first form of `comb`, with a [`Regex`](/type/Regex) that excludes multiples of ten, and a [`Range`](/type/Range) (which is `Cool`) as `$input`. `comb` stringifies the [`Range`](/type/Range) before applying `.comb` on the resulting string. Check [`Str.comb`](/type/Str#routine_comb) for its effect on different kind of input strings. When the first argument is an integer, it indicates the (maximum) size of the chunks the input is going to be divided in
  
  ```raku
  say comb(3,[3,33,333,3333]).join("*");  # OUTPUT: «3 3*3 3*33 *333*3␤»
  ```
  
  In this case the input is a list, which after transformation to [`Str`](/type/Str) (which includes the spaces) is divided in chunks of size 3.
  
  ## [method contains](#class_Cool "go to top of document")[§](#method_contains "direct link")
  
  ```raku
  method contains(Cool:D: |c)
  ```
  
  Coerces the invocant to a [`Str`](/type/Str), and calls [`Str.contains`](/type/Str#method_contains) on it. Please refer to that version of the method for arguments and general syntax.
  
  ```raku
  say 123.contains("2")# OUTPUT: «True␤»
  ```
  
  Since [`Int`](/type/Int) is a subclass of `Cool`, `123` is coerced to a [`Str`](/type/Str) and then `contains` is called on it.
  
  ```raku
  say (1,1, * + * … * > 250).contains(233)# OUTPUT: «True␤»
  ```
  
  [`Seq`](/type/Seq)s are also subclasses of `Cool`, and they are stringified to a comma-separated form. In this case we are also using an [`Int`](/type/Int), which is going to be stringified also; `"233"` is included in that sequence, so it returns `True`. Please note that this sequence is not lazy; the stringification of lazy sequences does not include each and every one of their components for obvious reasons.
  
  ## [routine index](#class_Cool "go to top of document")[§](#routine_index "direct link")
  
  ```raku
  multi        index(Cool:D $s, Cool:D $needle, :i(:$ignorecase), :m(:$ignoremark) --> Int:D)
  multi        index(Cool:D $s, Cool:D $needle, Cool:D $pos, :i(:$ignorecase), :m(:$ignoremark) --> Int:D)
  multi method index(Cool:D: Cool:D $needle --> Int:D)
  multi method index(Cool:D: Cool:D $needle, :m(:$ignoremark)! --> Int:D)
  multi method index(Cool:D: Cool:D $needle, :i(:$ignorecase)!, :m(:$ignoremark) --> Int:D)
  multi method index(Cool:D: Cool:D $needle, Cool:D $pos --> Int:D)
  multi method index(Cool:D: Cool:D $needle, Cool:D $pos, :m(:$ignoremark)!  --> Int:D)
  multi method index(Cool:D: Cool:D $needle, Cool:D $pos, :i(:$ignorecase)!, :m(:$ignoremark) --> Int:D)
  ```
  
  Coerces the first two arguments (in method form, also counting the invocant) to a [`Str`](/type/Str), and searches for `$needle` in the string `$s` starting from `$pos`. It returns the offset into the string where `$needle` was found, and [`Nil`](/type/Nil) if it was not found.
  
  See [the documentation in type Str](/type/Str#method_index) for examples.
  
  ## [routine rindex](#class_Cool "go to top of document")[§](#routine_rindex "direct link")
  
  ```raku
  multi        rindex(Cool:D $s, Cool:D $needle --> Int:D)
  multi        rindex(Cool:D $s, Cool:D $needle, Cool:D $pos --> Int:D)
  multi method rindex(Cool:D: Cool:D $needle --> Int:D)
  multi method rindex(Cool:D: Cool:D $needle, Cool:D $pos --> Int:D)
  ```
  
  Coerces the first two arguments (including the invocant in method form) to [`Str`](/type/Str) and `$pos` to [`Int`](/type/Int), and returns the last position of `$needle` in the string not after `$pos`. Returns [`Nil`](/type/Nil) if `$needle` wasn't found.
  
  See [the documentation in type Str](/type/Str#routine_rindex) for examples.
  
  ## [method match](#class_Cool "go to top of document")[§](#method_match "direct link")
  
  ```raku
  method match(Cool:D: $target, *%adverbs)
  ```
  
  Coerces the invocant to [`Stringy`](/type/Stringy) and calls the method [match](/type/Str#method_match) on it.
  
  ## [routine roots](#class_Cool "go to top of document")[§](#routine_roots "direct link")
  
  ```raku
  multi        roots(Numeric(Cool) $x, Int(Cool) $n)
  multi method roots(Int(Cool) $n)
  ```
  
  Coerces the first argument (and in method form, the invocant) to [`Numeric`](/type/Numeric) and the second (`$n`) to [`Int`](/type/Int), and produces a list of `$n` [`Complex`](/type/Complex) `$n`-roots, which means numbers that, raised to the `$n`th power, approximately produce the original number.
  
  For example
  
  ```raku
  my $original = 16;
  my @roots = $original.roots(4);
  say @roots;
  
  for @roots -> $r {
      say abs($r ** 4 - $original);
  }
  
  # OUTPUT:«2+0i 1.22464679914735e-16+2i -2+2.44929359829471e-16i -3.67394039744206e-16-2i␤»
  # OUTPUT:«1.77635683940025e-15␤»
  # OUTPUT:«4.30267170434156e-15␤»
  # OUTPUT:«8.03651692704705e-15␤»
  # OUTPUT:«1.04441561648202e-14␤»
  
  ```
  
  ## [method subst](#class_Cool "go to top of document")[§](#method_subst "direct link")
  
  ```raku
  method subst(|)
  ```
  
  Coerces the invocant to [`Stringy`](/type/Stringy) and calls