View source code
Display the source code in std/array.d from which this page was generated on
github.
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.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Function std.array.join
Concatenates all of the ranges in
together into one ror
array
using
as the separator if present.
sep
Prototypes
ElementEncodingType!(ElementType!RoR)[] join(RoR, R)( RoR ror, R sep ) if (isInputRange!RoR && isInputRange!(Unqual!(ElementType!RoR)) && isInputRange!R && is(Unqual!(ElementType!(ElementType!RoR)) == Unqual!(ElementType!R))); ElementEncodingType!(ElementType!RoR)[] join(RoR, E)( RoR ror, E sep ) if (isInputRange!RoR && isInputRange!(Unqual!(ElementType!RoR)) && is(E : ElementType!(ElementType!RoR))); ElementEncodingType!(ElementType!RoR)[] join(RoR)( RoR ror ) if (isInputRange!RoR && isInputRange!(Unqual!(ElementType!RoR)));
Parameters
Name | Description |
---|---|
ror | Range of Ranges of Elements |
sep | Range of Elements |
Returns
an allocated array
of Elements
See Also
Example
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");
Authors
Andrei Alexandrescu and Jonathan M Davis