%dw 2.0
output application/json
---
{ "result" : [0, 1, 2] ++ ["a", "b", "c"] }
++
++(Array<S>, Array<T>): Array<S | T>
Concatenates two values.
This version of ++
concatenates the elements of two arrays into a
new array. Other versions act on strings, objects, and the various date and
time formats that DataWeave supports.
If the two arrays contain different types of elements, the resulting array
is all of S
type elements of Array<S>
followed by all the T
type elements
of Array<T>
. Either of the arrays can also have mixed-type elements. Also
note that the arrays can contain any supported data type.
Parameters
Name | Description |
---|---|
|
The source array. |
|
The array to concatenate with the source array. |
++(String, String): String
Concatenates the characters of two strings.
Strings are treated as arrays of characters, so the ++
operator concatenates
the characters of each string as if they were arrays of single-character
string.
++(T, Q): T & Q
Concatenates two objects and returns one flattened object.
The ++
operator extracts all the key-values pairs from each object,
then combines them together into one result object.
Parameters
Name | Description |
---|---|
|
The source object. |
|
The object to concatenate with the source object. |
++(Date, LocalTime): LocalDateTime
Appends a LocalTime
with a Date
to return a LocalDateTime
value.
Date
and LocalTime
instances are written in standard Java notation,
surrounded by pipe (|
) symbols. The result is a LocalDateTime
object
in the standard Java format. Note that the order in which the two objects are
concatenated is irrelevant, so logically, Date LocalTime` produces the
same result as `LocalTime Date
.
++(LocalTime, Date): LocalDateTime
Appends a LocalTime
with a Date
to return a LocalDateTime
.
Note that the order in which the two objects are concatenated is irrelevant,
so logically, LocalTime Date` produces the same result as
`Date LocalTime
.
++(Date, Time): DateTime
Appends a Date
to a Time
in order to return a DateTime
.
Note that the order in which the two objects are concatenated is irrelevant,
so logically, Date
+ Time
produces the same result as Time
+ Date
.
++(Time, Date): DateTime
Appends a Date
to a Time
object to return a DateTime
.
Note that the order in which the two objects are concatenated is irrelevant,
so logically, Date
+ Time
produces the same result as a Time
+ Date
.
Parameters
Name | Description |
---|---|
|
A |
|
A |
Example
This example concatenates a Date
with a Time
to output a DateTime
.
Notice that the inputs are surrounded by pipes (|
).
Example
This example concatenates Time
and Date
objects to return DateTime
objects. Note that the first LocalTime
object is coerced to a `Time
.
Notice that the order of the date and time inputs does not change the order
of the output DateTime
.