join
ErrorsCollection

join

Synthesised documentation from type/IO/Spec/Cygwin type/Any type/IO/Spec/Win32 type/Thread type/IO/Spec/Unix type/List

From type/IO/Spec/Cygwin

See Original text in context

method join(|c)

Same as IO::Spec::Win32.join, except replaces backslashes with slashes in the final result.

From type/Any

See Original text in context

method join($separator = ''is nodal

Converts the object to a list by calling self.list, and calls .join on the list. Can take a separator, which is an empty string by default.

(1..3).join.say;       # OUTPUT: «123␤» 
<a b c>.join("").put# OUTPUT: «a❧b❧c␤»

From type/IO/Spec/Win32

See Original text in context

method join (Str:D $volumeStr:D $dirStr:D $file --> Str:D)

Similar to catpath, takes two path fragments and concatenates them, adding or removing a path separator, if necessary, except it will return just $file if both $dir and $file are string '/' or if $dir is the string '.'. The first argument is ignored (it exists to maintain consistent interface with other IO::Spec types for systems that have volumes).

IO::Spec::Win32.join('C:''/some/dir''foo.txt').say;
# OUTPUT: «C:/some/dir\and/more␤» 
 
IO::Spec::Win32.join('C:''.''foo.txt').say;
# OUTPUT: «C:foo.txt␤» 
 
IO::Spec::Win32.join('C:'\'/').say;
# OUTPUT: «C:\␤» 
 
IO::Spec::Win32.join('//server/share'\'/').say;
# OUTPUT: «//server/share␤» 
 
IO::Spec::Win32.join('E:''''foo.txt').say;
# OUTPUT: «E:foo.txt␤»

From type/Thread

See Original text in context

method join(Thread:D:)

Waits for the thread to finish.

From type/IO/Spec/Unix

See Original text in context

method join ($Str:D $dirStr:D $file --> Str:D)

Similar to catpath, takes two path fragments and concatenates them, adding or removing a path separator, if necessary, except it will return just $file if both $dir and $file are string '/' or if $dir is the string '.'. The first argument is ignored (it exists to maintain consistent interface with other IO::Spec types for systems that have volumes).

IO::Spec::Unix.join($'foo''bar').say# OUTPUT: «foo/bar␤» 
IO::Spec::Unix.join($'/''/').say;     # OUTPUT: «/␤» 
IO::Spec::Unix.join($'.''foo').say;   # OUTPUT: «foo␤» 
say $*SPEC.join(True,".","/foo");         # OUTPUT: «/foo␤»

From type/List

See Original text in context

sub    join($separator*@list)
method join(List:D: $separator = "")

Treats the elements of the list as strings by calling .Str on each of them, interleaves them with $separator and concatenates everything into a single string.

Example:

say join '', <a b c>;             # OUTPUT: «a, b, c␤»

The method form also allows you to omit the separator:

say <a b c>.join;               # OUTPUT: «abc␤»

Note that the method form does not flatten sublists:

say (1, <a b c>).join('|');     # OUTPUT: «1|a b c␤»

The subroutine form behaves slurpily, flattening all arguments after the first into a single list:

say join '|'1, <a b c>;       # OUTPUT: «1|a|b|c␤»

In this case, the list <a b c> is slurped and flattened, unlike what happens when join is invoked as a method.

If one of the elements of the list happens to be a Junction, then join will also return a Junction with concatenation done as much as possible:

say ("a"|"b","c","d").join;     # OUTPUT: «any(acd,bcd)␤»