See Original text in context
method is-absolute(Str --> Bool)
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»
See Original text in context
method is-absolute(IO::Path: --> 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»
See Original text in context
method is-absolute(Str --> Bool)
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»
See Original text in context
method is-absolute(Str --> Bool)
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»