method splitpath
Documentation for method splitpath
assembled from the following types:
class IO::Spec::Cygwin
From IO::Spec::Cygwin
(IO::Spec::Cygwin) method splitpath
Defined as:
method splitpath(|c --> List:D)
Same as IO::Spec::Win32.splitpath
, except replaces backslashes with slashes in all the values of the final result.
class IO::Spec::Unix
From IO::Spec::Unix
(IO::Spec::Unix) method splitpath
Defined as:
method splitpath(Cool:D $path, :$nofile --> List:D)
Splits the given $path
into a list of 3 strings: volume, dirname, and file. The volume is always an empty string, returned for API compatibility with other IO::Spec types. If :$nofile
named argument is set to True
, the content of the file string is undefined and should be ignored; this is a means to get a performance boost, as implementations may use faster code path when file is not needed.
IO::Spec::Unix.splitpath('C:\foo/bar.txt').raku.say; # OUTPUT: «("", "C:\\foo/", "bar.txt")» IO::Spec::Unix.splitpath('C:\foo/bar.txt', :nofile).raku.say; # OUTPUT: «("", "C:\\foo/bar.txt", "")» IO::Spec::Unix.splitpath('/foo/').raku.say; # OUTPUT: «("", "/foo/", "")» IO::Spec::Unix.splitpath('/foo/', :nofile).raku.say; # OUTPUT: «("", "/foo/", "")» IO::Spec::Unix.splitpath('///').raku.say; # OUTPUT: «("", "///", "")» IO::Spec::Unix.splitpath('./').raku.say; # OUTPUT: «("", "./", "")» IO::Spec::Unix.splitpath('.').raku.say; # OUTPUT: «("", "", ".")» IO::Spec::Unix.splitpath('').raku.say; # OUTPUT: «("", "", "")»
class IO::Spec::Win32
From IO::Spec::Win32
(IO::Spec::Win32) method splitpath
Defined as:
method splitpath(Cool:D $path, :$nofile --> List:D)
Splits the given $path
into a list of 3 strings: volume, dirname, and file. The volume is always an empty string, returned for API compatibility with other IO::Spec types. If :$nofile
named argument is set to True
, the content of the file string is undefined and should be ignored; this is a means to get a performance boost, as implementations may use faster code path when file is not needed.
IO::Spec::Win32.splitpath('C:\foo/bar.txt').raku.say; # OUTPUT: «("C:", "\\foo/", "bar.txt")» IO::Spec::Win32.splitpath('C:\foo/bar.txt', :nofile).raku.say; # OUTPUT: «("C:", "\\foo/bar.txt", "")» IO::Spec::Win32.splitpath('/foo/').raku.say; # OUTPUT: «("", "/foo/", "")» IO::Spec::Win32.splitpath('/foo/', :nofile).raku.say; # OUTPUT: «("", "/foo/", "")» IO::Spec::Win32.splitpath('///').raku.say; # OUTPUT: «("", "///", "")» IO::Spec::Win32.splitpath('./').raku.say; # OUTPUT: «("", "./", "")» IO::Spec::Win32.splitpath('.').raku.say; # OUTPUT: «("", "", ".")» IO::Spec::Win32.splitpath('').raku.say; # OUTPUT: «("", "", "")»