File_Utilities module

path_contains

procedureSource

Whether the names words appear next to each other, in that order, among the words of path; and where the first match starts.

path_contains :: (
    path: Path,
    words: [] string
) -> (contains: bool, position: s32)

The position is 0 when there is no match. An empty words matches at position 0. Names are compared exactly, byte for byte, also on Windows.

Parameters

path: Path
words: [] string

Returns

contains: bool
position: s32
Example↗
path := parse_path("src/app/models/user");
found, position := path_contains(path, .["app", "models"]);
assert(found && position == 1);
found, position = path_contains(path, .["models", "app"]);
assert(!found);
array_free(path.words);

See also