String module

is_absolute_path

procedure · 1 overloadSource

Whether path is absolute: it starts with / elsewhere, or with a drive letter, : and a separator on Windows. Not defined on every platform.

is_absolute_path :: (path: string) -> bool

Parameters

path: string

Returns

bool
ExampleOpen in playground ↗
#if OS == .WINDOWS assert(is_absolute_path("C:\\dir"));
else assert(is_absolute_path("/dir") && !is_absolute_path("dir"));

See also