String module

join

procedure · 1 overloadSource

The strings one after another, with separator between them.

ExampleOpen in playground ↗
assert(join("a", "b", "c", separator = "-") == "a-b-c");
join :: (
    inputs: ..string,
    separator := "",
    before_first := false,
    after_last := false
) -> string

The strings one after another with separator between them, in a new string that the caller frees.

Parameters

inputs: ..string
separator := ""
goes between the strings.
before_first := false
also put the separator before the first string.
after_last := false
also put the separator after the last string.

Returns

string
ExampleOpen in playground ↗
joined := join("a", "b", "c", separator = ", ");
defer free(joined);
assert(joined == "a, b, c");

See also