is-absolute
ErrorsCollection

is-absolute

Synthesised documentation from type/IO/Spec/Cygwin type/IO/Path type/IO/Spec/Win32 type/IO/Spec/Unix

From type/IO/Spec/Cygwin

See Original text in context

method is-absolute(Str:D $path --> Bool:D)

Returns True if the $path starts with a slash ("/") or backslash ("\"), even if they have combining character on them, optionally preceded by a volume:

say IO::Spec::Cygwin.is-absolute: "/foo";        # OUTPUT: «True␤» 
say IO::Spec::Cygwin.is-absolute: "/\x[308]foo"# OUTPUT: «True␤» 
say IO::Spec::Cygwin.is-absolute: C:\foo;      # OUTPUT: «True␤» 
say IO::Spec::Cygwin.is-absolute: "bar";         # OUTPUT: «False␤»

From type/IO/Path

See Original text in context

method is-absolute(IO::Path:D: --> Bool)

Returns True if the path is an absolute path, and False otherwise.

"/foo".IO.is-absolute.say# OUTPUT: «True␤» 
"bars".IO.is-absolute.say# OUTPUT: «False␤»

Note that on Windows a path that starts with a slash or backslash is still considered absolute even if no volume was given, as it is absolute for that particular volume:

IO::Path::Win32.new("/foo"  ).is-absolute.say# OUTPUT: «True␤» 
IO::Path::Win32.new("C:/foo").is-absolute.say# OUTPUT: «True␤» 
IO::Path::Win32.new("C:foo" ).is-absolute.say# OUTPUT: «False␤»

From type/IO/Spec/Win32

See Original text in context

method is-absolute(Str:D $path --> Bool:D)

Returns True if the $path starts with a slash ("/") or backslash ("\"), even if they have combining character on them, optionally preceded by a volume:

say IO::Spec::Win32.is-absolute: "/foo";        # OUTPUT: «True␤» 
say IO::Spec::Win32.is-absolute: "/\x[308]foo"# OUTPUT: «True␤» 
say IO::Spec::Win32.is-absolute: C:\foo;      # OUTPUT: «True␤» 
say IO::Spec::Win32.is-absolute: "bar";         # OUTPUT: «False␤»

From type/IO/Spec/Unix

See Original text in context

method is-absolute(Str:D $path --> Bool:D)

Returns True if the $path starts with a slash ("/"), even if it has combining character on it:

say IO::Spec::Unix.is-absolute: "/foo";        # OUTPUT: «True␤» 
say IO::Spec::Unix.is-absolute: "/\x[308]foo"# OUTPUT: «True␤» 
say IO::Spec::Unix.is-absolute: "bar";         # OUTPUT: «False␤»