This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
JOIN
Dan Gorman edited this page Nov 29, 2018
·
2 revisions
JOIN
joins arguments with a provided delimiter argument.
JOIN(arg1, arg2, [arg3])
-
arg1
is the delimiter to use to join text -
arg2
is a string or array of strings -
arg3
is optional, and is another string or array of strings -
JOIN
can take an arbitrary number of optional arguments
Let's say we're given a response with a list of car manufacturers for a given part:
{
"data":{
"parts":{
"part_1":[
"Toyota",
"Hyundai",
"Kia",
"Mercedes Benz"
],
"part_2":[
"BMW",
"Mercedes Benz",
"Ford",
"Tesla"
]
}
}
}
If we want to compile an easier to read version of the distributors for a given part, we can use JOIN
:
JOIN(", " data.parts.part_1)
This will return "Toyota, Hyundai, Kia, Mercedes Benz"
.
We can also add the third, optional argument, to combine multiple values or arrays, like this:
JOIN(", " data.parts.part_1, data.parts.part_2) => "Toyota, Hyundai, Kia, Mercedes Benz, BMW, Mercedes Benz, Ford, Tesla"