String module

path_decomp

procedure · 1 overloadSource

Splits name into its directory (with the trailing separator), its name without the extension, the extension without the dot, and the name with the extension. All four point into name; a missing part is empty.

path_decomp :: (
    name: string
) -> (path: string, basename: string, extension: string, basename_with_extension: string)

Parameters

name: string

Returns

path: string
basename: string
extension: string
basename_with_extension: string
ExampleOpen in playground ↗
dir, base, ext, file := path_decomp("src/main.jai");
assert(dir == "src/" && base == "main" && ext == "jai" && file == "main.jai");

See also