txt: ## str.md
  Str
  
  Combined from primary sources listed below.
  
  # [In List](#___top "go to top of document")[§](#(List)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/List#method_Str)
  for **method Str**.
  
  ```raku
  method Str(List:D: --> Str:D)
  ```
  
  Stringifies the elements of the list and joins them with spaces (same as `.join(' ')`).
  
  ```raku
  say (1,2,3,4,5).Str; # OUTPUT: «1 2 3 4 5␤»
  ```
  
  # [In role Sequence](#___top "go to top of document")[§](#(role_Sequence)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Sequence#method_Str)
  for **method Str**.
  
  ```raku
  multi method Str(::?CLASS:D:)
  ```
  
  [Stringifies](/type/List#method_Str) the [cached](/type/PositionalBindFailover#method_cache) sequence.
  
  # [In Num](#___top "go to top of document")[§](#(Num)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Num#method_Str)
  for **method Str**.
  
  ```raku
  method Str(Int:D)
  ```
  
  Returns a string representation of the number.
  
  ```raku
  say π.Str;                # OUTPUT: «3.141592653589793␤»
  ```
  
  [`Cool`](/type/Cool) being a parent class of `Num`, an explicit call to the `Num.Str` method is seldom needed.
  
  ```raku
  say π.Str.comb == π.comb; # OUTPUT: «True␤»
  ```
  
  # [In ForeignCode](#___top "go to top of document")[§](#(ForeignCode)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/ForeignCode#method_Str)
  for **method Str**.
  
  ```raku
  method Str( ForeignCode:D: )
  ```
  
  Returns the name of the code by calling `name`.
  
  # [In IO::Special](#___top "go to top of document")[§](#(IO::Special)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/IO/Special#method_Str)
  for **method Str**.
  
  ```raku
  method Str(IO::Special:D:)
  ```
  
  This returns `'<STDIN>'`, `'<STDOUT>'`, or `'<STDERR>'` as appropriate.
  
  # [In Version](#___top "go to top of document")[§](#(Version)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Version#method_Str)
  for **method Str**.
  
  ```raku
  method Str(Version:D: --> Str:D)
  ```
  
  Returns a string representation of the invocant.
  
  ```raku
  my $v1 = v1.0.1;
  my $v2 = Version.new('1.0.1');
  say $v1.Str;                                      # OUTPUT: «1.0.1␤»
  say $v2.Str;                                      # OUTPUT: «1.0.1␤»
  ```
  
  # [In IO::Handle](#___top "go to top of document")[§](#(IO::Handle)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/IO/Handle#method_Str)
  for **method Str**.
  
  Returns the value of [`.path`](/type/IO/Handle#method_path), coerced to [`Str`](/type/Str).
  
  ```raku
  say "foo".IO.open.Str; # OUTPUT: «foo␤»
  
  ```
  
  # [In role Systemic](#___top "go to top of document")[§](#(role_Systemic)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Systemic#method_Str)
  for **method Str**.
  
  ```raku
  method Str
  ```
  
  Instance method returning the name of the object.
  
  ```raku
  say $*RAKU.Str; # OUTPUT: «Raku␤»
  ```
  
  # [In RakuAST::Doc::Paragraph](#___top "go to top of document")[§](#(RakuAST::Doc::Paragraph)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/RakuAST/Doc/Paragraph#method_Str)
  for **method Str**.
  
  ```raku
  put $paragraph;  # Text before B<and> after markup␤␤
  
  ```
  
  Returns the string for the paragraph, with any markup stringified.
  
  # [In Match](#___top "go to top of document")[§](#(Match)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Match#method_Str)
  for **method Str**.
  
  ```raku
  method Str(Match:D: --> Str:D)
  ```
  
  Returns the matched text.
  
  ```raku
  "abc123def" ~~ /\d+/;
  say $/.Str;               # OUTPUT: «123␤»
  ```
  
  # [In StrDistance](#___top "go to top of document")[§](#(StrDistance)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/StrDistance#method_Str)
  for **method Str**.
  
  ```raku
  multi method Str(StrDistance:D: --> Str)
  ```
  
  Returns an `after` string value.
  
  ```raku
  my $str-dist = ($str ~~ tr/old/new/);
  say $str-dist.Str; # OUTPUT: «fnew␤»
  say ~$str-dist;    # OUTPUT: «fnew␤»
  
  ```
  
  # [In RakuAST::Doc::Markup](#___top "go to top of document")[§](#(RakuAST::Doc::Markup)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/RakuAST/Doc/Markup#method_Str)
  for **method Str**.
  
  ```raku
  put $markup;  # B<and>␤
  
  ```
  
  Returns the string for the markup object, with any embedded markup also stringified.
  
  # [In Pair](#___top "go to top of document")[§](#(Pair)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Pair#method_Str)
  for **method Str**.
  
  ```raku
  multi method Str(Pair:D: --> Str:D)
  ```
  
  Returns a string representation of the invocant formatted as *key ~ \t ~ value*.
  
  ```raku
  my $b = eggs => 3;
  say $b.Str;                                       # OUTPUT: «eggs  3␤»
  ```
  
  # [In RakuAST::Doc::Block](#___top "go to top of document")[§](#(RakuAST::Doc::Block)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/RakuAST/Doc/Block#method_Str)
  for **method Str**.
  
  ```raku
  put $block;  # bar␤
  
  ```
  
  Returns the string for the paragraphs of the block, with any markup also stringified.
  
  # [In Label](#___top "go to top of document")[§](#(Label)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Label#method_Str)
  for **method Str**.
  
  Converts to a string including the name, file and line it's been defined in.
  
  # [In Mu](#___top "go to top of document")[§](#(Mu)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Mu#method_Str)
  for **method Str**.
  
  ```raku
  multi method Str(--> Str)
  ```
  
  Returns a string representation of the invocant, intended to be machine readable. Method [`Str`](/type/Str) warns on type objects, and produces the empty string.
  
  ```raku
  say Mu.Str;   # Use of uninitialized value of type Mu in string context.
  my @foo = [2,3,1];
  say @foo.Str  # OUTPUT: «2 3 1␤»
  ```
  
  # [In role Blob](#___top "go to top of document")[§](#(role_Blob)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Blob#method_Str)
  for **method Str**.
  
  ```raku
  multi method Str(Blob:D:)
  ```
  
  Throws [`X::Buf::AsStr`](/type/X/Buf/AsStr) with [`Str`](/type/Str) as payload. In order to convert to a [`Str`](/type/Str) you need to use [`.decode`](/routine/decode).
  
  # [In IO::CatHandle](#___top "go to top of document")[§](#(IO::CatHandle)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/IO/CatHandle#method_Str)
  for **method Str**.
  
  ```raku
  method Str(IO::CatHandle:D: --> Str:D)
  ```
  
  Calls [`.Str`](/type/IO/Handle#method_Str) on the currently active source handle and returns the result. If the [source handle queue has been exhausted](/type/IO/CatHandle#method_next-handle), returns an implementation-defined string (`'<closed IO::CatHandle>'` in Rakudo).
  
  # [In Nil](#___top "go to top of document")[§](#(Nil)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Nil#method_Str)
  for **method Str**.
  
  ```raku
  method Str()
  ```
  
  Warns the user that they tried to stringify a `Nil`.
  
  # [In IO::Path](#___top "go to top of document")[§](#(IO::Path)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/IO/Path#method_Str)
  for **method Str**.
  
  ```raku
  method Str(IO::Path:D: --> Str)
  ```
  
  Alias for [`IO::Path.path`](/routine/path). In particular, note that default stringification of an `IO::Path` does **NOT** use the value of [`$.CWD` attribute](/type/IO/Path#attribute_CWD). To stringify while retaining full path information use [`.absolute`](/routine/absolute) or [`.relative`](/routine/relative) methods.
  
  # [In Code](#___top "go to top of document")[§](#(Code)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Code#method_Str)
  for **method Str**.
  
  ```raku
  multi method Str(Code:D: --> Str:D)
  ```
  
  Will output the method name, but also produce a warning. Use `.raku` or `.gist` instead.
  
  ```raku
  sub marine() { }
  say ~&marine;
  # OUTPUT: «Sub object coerced to string (please use .gist or .raku to do that)␤marine␤»
  say &marine.Str;
  # OUTPUT: «Sub object coerced to string (please use .gist or .raku to do that)␤marine␤»
  say &marine.raku; # OUTPUT: «sub marine { #`(Sub|94280758332168) ... }␤»
  ```
  
  # [In Junction](#___top "go to top of document")[§](#(Junction)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Junction#method_Str)
  for **method Str**.
  
  ```raku
  multi method Str(Junction:D:)
  ```
  
  Autothreads the `.Str` method over its elements and returns results as a `Junction`. Output methods that use `.Str` method ([print](/routine/print) and [put](/routine/put)) are special-cased to autothread junctions, despite being able to accept a [`Mu`](/type/Mu) type.
  
  # [In Thread](#___top "go to top of document")[§](#(Thread)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Thread#method_Str)
  for **method Str**.
  
  ```raku
  method Str(Thread:D: --> Str:D)
  ```
  
  Returns a string which contains the invocants [thread id](#method_id) and [name](#method_name).
  
  ```raku
  my $t = Thread.new(code => { for 1..5 -> $v { say $v }}, name => 'calc thread');
  say $t.Str;                           # OUTPUT: «Thread<3>(calc thread)␤»
  ```
  
  # [In Int](#___top "go to top of document")[§](#(Int)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Int#method_Str)
  for **method Str**.
  
  ```raku
  multi method Str(Int:D)
  multi method Str(Int:D, :$superscript)
  multi method Str(Int:D, :$subscript)
  ```
  
  Returns a string representation of the number.
  
  ```raku
  say 42.Str;                # OUTPUT: «42␤»
  ```
  
  [`Cool`](/type/Cool) being a parent class of `Int`, an explicit call to the `Int.Str` method is seldom needed, unless you want the string to be returned in superscript or subscript.
  
  ```raku
  say 42.Str(:superscript); # OUTPUT: «⁴²␤»
  say 42.Str(:subscript);   # OUTPUT: «₄₂␤»
  ```
  
  The `:superscript` and `:subscript` named arguments are available as of the 2023.05 Rakudo compiler release.
  
  # [In DateTime](#___top "go to top of document")[§](#(DateTime)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/DateTime#method_Str)
  for **method Str**.
  
  ```raku
  method Str(DateTime:D: --> Str:D)
  ```
  
  Returns a string representation of the invocant, as done by [the formatter](/type/Dateish#method_formatter). If no formatter was specified, an ISO 8601 timestamp will be returned.
  
  ```raku
  say DateTime.new('2015-12-24T12:23:00+0200').Str;
  # OUTPUT: «2015-12-24T12:23:00+02:00␤»
  
  ```
  
  # [In role Real](#___top "go to top of document")[§](#(role_Real)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Real#method_Str)
  for **method Str**.
  
  ```raku
  multi method Str(Real:D:)
  ```
  
  Calls the [`Bridge` method](/routine/Bridge) on the invocant and then the [`Str` method](/routine/Str) on its return value.
  
  # [In Backtrace](#___top "go to top of document")[§](#(Backtrace)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Backtrace#method_Str)
  for **method Str**.
  
  ```raku
  multi method Str(Backtrace:D:)
  ```
  
  Returns a concise string representation of the backtrace, omitting routines marked as `is hidden-from-backtrace`, and at the discretion of the implementation, also some routines from the setting.
  
  ```raku
  my $backtrace = Backtrace.new;
  say $backtrace.Str;
  ```
  
  # [In Allomorph](#___top "go to top of document")[§](#(Allomorph)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Allomorph#method_Str)
  for **method Str**.
  
  ```raku
  method Str(Allomorph:D:)
  ```
  
  Returns the [`Str`](/type/Str) value of the invocant.
  
  # [In Date](#___top "go to top of document")[§](#(Date)_method_Str "direct link")
  
  See primary documentation
  [in context](/type/Date#method_Str)
  for **method Str**.
  
  ```raku
  multi method Str(Date:D: --> Str:D)
  ```
  
  Returns a string representation of the invocant, as specified by [the formatter](/type/Dateish#method_formatter). If no formatter was specified, an ([ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)) date will be returned.
  
  ```raku
  say Date.new('2015-12-24').Str;                     # OUTPUT: «2015-12-24␤»
  
  my $fmt = { sprintf "%02d/%02d/%04d", .month, .day, .year };
  say Date.new('2015-12-24', formatter => $fmt).Str;  # OUTPUT: «12/24/2015␤»
  ```
  