View source code
Display the source code in std/array.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Function std.array.join
Eagerly concatenates all of the ranges in ror
together (with the GC)
into one array using sep
as the separator if present.
ElementEncodingType!(ElementType!RoR)[] join(RoR, R)
(
RoR ror,
scope R sep
)
if (isInputRange!RoR && isInputRange!(Unqual!(ElementType!RoR)) && isInputRange!R && (is(immutable(ElementType!(ElementType!RoR)) == immutable(ElementType!R)) || isSomeChar!(ElementType!(ElementType!RoR)) && isSomeChar!(ElementType!R)));
ElementEncodingType!(ElementType!RoR)[] join(RoR, E)
(
RoR ror,
scope E sep
)
if (isInputRange!RoR && isInputRange!(Unqual!(ElementType!RoR)) && (is(E : ElementType!(ElementType!RoR)) || !autodecodeStrings && isSomeChar!(ElementType!(ElementType!RoR)) && isSomeChar!E));
ElementEncodingType!(ElementType!RoR)[] join(RoR)
(
RoR ror
)
if (isInputRange!RoR && isInputRange!(Unqual!(ElementType!RoR)));
Parameters
Name | Description |
---|---|
ror | An input range of input ranges |
sep | An input range, or a single element, to join the ranges on |
Returns
An array of elements
See Also
For a lazy version, see joiner
Example
writeln(join(["hello", "silly", "world"], " ")); // "hello silly world"
writeln(join(["hello", "silly", "world"])); // "hellosillyworld"
writeln(join([[1, 2, 3], [4, 5]], [72, 73])); // [1, 2, 3, 72, 73, 4, 5]
writeln(join([[1, 2, 3], [4, 5]])); // [1, 2, 3, 4, 5]
const string[] arr = ["apple", "banana"];
writeln(arr .join(",")); // "apple,banana"
writeln(arr .join()); // "applebanana"
Authors
License
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.