The OpenD Programming Language

join

Eagerly concatenates all of the ranges in ror together (with the GC) into one array using sep as the separator if present.

Parameters

ror RoR

An input range of input ranges

sep R

An input range, or a single element, to join the ranges on

Return Value

Type: ElementEncodingType!(ElementType!RoR)[]

An array of elements

Examples

assert(join(["hello", "silly", "world"], " ") == "hello silly world");
assert(join(["hello", "silly", "world"]) == "hellosillyworld");

assert(join([[1, 2, 3], [4, 5]], [72, 73]) == [1, 2, 3, 72, 73, 4, 5]);
assert(join([[1, 2, 3], [4, 5]]) == [1, 2, 3, 4, 5]);

const string[] arr = ["apple", "banana"];
assert(arr.join(",") == "apple,banana");
assert(arr.join() == "applebanana");

See Also

For a lazy version, see std.algorithm.iteration.joiner

Meta