XU XUv0.16.0

#path

import: #path

counts: 11 functions, 0 methods, 0 types, 0 constants, 0 method sets

POSIX slash paths: join/clean/split/base/dir/ext/matches.

is_abs

XuAPI
pub fn is_abs(p &string) bool

Purpose

Whether it is abs.

Parameters

p &string
p (read-only borrow; caller keeps the original; type &string)

Returns

bool — true or false

base

XuAPI
pub fn base(p &string) string

Purpose

Return the last element of path.

Parameters

p &string
p (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

dir

XuAPI
pub fn dir(p &string) string

Purpose

Return all but the last element of path.

Parameters

p &string
p (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

ext

XuAPI
pub fn ext(p &string) string

Purpose

Return the file name extension used by path.

Parameters

p &string
p (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

split_list

XuAPI
pub fn split_list(s &string) []string

Purpose

Split list.

Parameters

s &string
source string (read-only borrow; caller keeps the original; type &string)

Returns

[]string — slice result

join

XuAPI
pub fn join(parts []string) string

Purpose

Join pieces with a separator.

Parameters

parts []string
parts ([]string)

Returns

string — result string

split

XuAPI
pub fn split(p &string) []string

Purpose

split returns [dir, file] like path.Split (dir keeps trailing /).

Parameters

p &string
p (read-only borrow; caller keeps the original; type &string)

Returns

[]string — slice result

clean

XuAPI
pub fn clean(p &string) string

Purpose

clean folds.,.., and repeated separators ( path.Clean). Uses an int offset stack + string buffer (not []string[len-1] rebuild) that branch was not taken (frame/index poison).

Parameters

p &string
p (read-only borrow; caller keeps the original; type &string)

Returns

string — result string

matches

XuAPI
pub fn matches(pattern &string, name &string) bool

Purpose

match reports whether name matches pattern ( path.Match (Xu: matches)). Throws on failure; handle the error or propagate it to the caller.

Parameters

pattern &string
pattern (read-only borrow; caller keeps the original; type &string)
name &string
name (read-only borrow; caller keeps the original; type &string)

Returns

bool — true or false

has_prefix

XuAPI
pub fn has_prefix(p &string, prefix string) bool

Purpose

Report whether the value has the given prefix.

Parameters

p &string
p (read-only borrow; caller keeps the original; type &string)
prefix string
prefix (string)

Returns

bool — true or false

has_suffix

XuAPI
pub fn has_suffix(p &string, suffix string) bool

Purpose

Report whether the value has the given suffix.

Parameters

p &string
p (read-only borrow; caller keeps the original; type &string)
suffix string
suffix (string)

Returns

bool — true or false