std.string.path

path-count

added in 3.0

(path-count s)(path-count s sep)

counts the number of elements in a given path

(path/path-count “a/b/c”) => 3

((wrap path/path-count) ns) => 3

path-join

added in 3.0

(path-join arr)(path-join arr sep)

joins a sequence of elements into a path separated value

(path/path-join “a” “b” “c”) => “a/b/c”

((wrap path/path-join) ’:a :b :c “-”) => :a-b-c

((wrap path/path-join) ’a b c ’-) => ’a-b-c

path-ns

added in 3.0

(path-ns s)(path-ns s sep)

returns the path namespace of the string

(path/path-ns “a/b/c/d”) => “a/b/c”

((wrap path/path-ns) :a.b.c “.”) => :a.b

path-ns-array

added in 3.0

(path-ns-array s)(path-ns-array s sep)

returns the path vector of the string

(path/path-ns-array “a/b/c/d”) => “a” “b” “c”

((wrap path/path-ns-array) (keyword “a/b/c/d”)) => :a :b :c

path-nth

added in 3.0

(path-nth s n)(path-nth s n sep)

check for the val of the string

(path/path-nth “a/b/c/d” 2) => “c”

path-root

added in 3.0

(path-root s)(path-root s sep)

returns the path root of the string

(path/path-root “a/b/c/d”) => “a”

((wrap path/path-root) ’a.b.c “.”) => ’a

path-split

added in 3.0

(path-split s)(path-split s sep)

splits a sequence of elements into a path separated value

(path/path-split “a/b/c/d”) => ’“a” “b” “c” “d”

(path/path-split “a.b.c.d” “.”) => “a” “b” “c” “d”

((wrap path/path-split) :hello/world) => :hello :world

((wrap path/path-split) :hello.world “.”) => :hello :world

path-stem

added in 3.0

(path-stem s)(path-stem s sep)

returns the path stem of the string

(path/path-stem “a/b/c/d”) => “b/c/d”

((wrap path/path-stem) ’a.b.c.d “.”) => ’b.c.d

path-stem-array

added in 3.0

(path-stem-array s)(path-stem-array s sep)

returns the path stem vector of the string

(path/path-stem-array “a/b/c/d”) => “b” “c” “d”

((wrap path/path-stem-array) ’a.b.c.d “.”) => ’b c d

path-sub

added in 3.0

(path-sub s start num)(path-sub s start num sep)

returns a subsection of the path within the string

(path/path-sub “a/b/c/d” 1 2) => “b/c”

((wrap path/path-sub) (symbol “a/b/c/d”) 1 2) => ’b/c

path-sub-array

added in 3.0

(path-sub-array s start num)(path-sub-array s start num sep)

returns a sub array of the path within the string

(path/path-sub-array “a/b/c/d” 1 2) => “b” “c”

((wrap path/path-sub-array) (symbol “a/b/c/d”) 1 2) => ’b c

path-val

added in 3.0

(path-val s)(path-val s sep)

returns the val of the string

(path/path-val “a/b/c/d”) => “d”

((wrap path/path-val) ’a.b.c.d “.”) => ’d