Capy-Bearer Documentation

join

lib call

Capy

function join(items : any, delimiter : string = "\n") string

Description

join() reads each list value as text. It uses a newline when you omit the delimiter. An empty list produces an empty string. Empty values keep their positions, so joining any(["a", "", "b"]) with "|" produces "a||b".

A map also works. The result contains its values in insertion order, without keys. For example, join({a: 1, b: true, c: none}, "|") produces "1|true|".

Convert a typed array explicitly, as in join(any(["a", "b"]), ","). The result is plain text, with no quoting or delimiter escaping. Use a serialization function when values can contain the delimiter.

Parameters

items : an any list

delimiter : text between values

Return Values

One string with the values separated by delimiter.

Example

Capy

print(join(split("a,b,c", ","), "-"), "\n")

Output

a-b-c