Skip to main content

$$join

Joins an array of input as strings with an optional delimiter (default is ""), prefix and suffix. null values are omitted

Usage​

{ 
"$$join": /* Array of elements */,
"delimiter": "" /* string */,
"prefix": "" /* string */,
"suffix": "" /* string */,
"keep_nulls": false /* boolean */
}
"$$join([delimiter],[prefix],[suffix],[keep_nulls]):{input}"
note

Concrete values in the usage example are default values.

Returns​

string

Arguments​

ArgumentTypeValuesRequired / Default ValueDescription
PrimaryarrayYesArray of elements
delimiterstring""Delimiter to join any 2 adjacent elements
prefixstring""A string to prefix the result
keep_nullsbooleanfalse/truefalseWhether to keep null values when joining
suffixstring""A string to suffix the result

Examples​

Input

Definition

Output

[
"a",
"b",
"c"
]
{
"$$join": "$"
}
"abc"
[
"a",
"b",
"c"
]
{
"$$join": [
"$[0]",
"B"
]
}
"aB"
[
"a",
"b",
"c"
]
{
"$$join": [
"$[0]",
null,
null,
"B"
],
"delimiter": ","
}
"a,B"
[
"a",
"b",
"c"
]
{
"$$join": "$",
"$$delimiter": ","
}
"a,b,c"
[
"hello",
"world"
]
{
"$$join": "$",
"delimiter": " ",
"prefix": "<"
}
"<hello world"
[
"hello",
"world"
]
{
"$$join": "$",
"delimiter": " ",
"prefix": "<",
"suffix": ">"
}
"<hello world>"
[
"hello",
" ",
"world"
]
"$$join:$"
"hello world"
[
"hello",
" ",
"world"
]
"$$join():$"
"hello world"
[
"hello",
5,
true
]
"$$join:$"
"hello5true"
[
"hello",
" ",
"world"
]
"$$join:$"
"hello world"
[
"hello",
" ",
"world"
]
"$$join:$"
"hello world"
[
"hello",
null,
"world"
]
"$$join(' '):$"
"hello world"
[
"hello",
null,
"world"
]
"$$join(' ',,,true):$"
"hello null world"
[
"hello",
" ",
"world"
]
"$$join(,):$"
"hello world"
[
"hello",
" ",
"world"
]
"$$join(:):$"
"hello: :world"
[
"hello",
" ",
"world"
]
"$$join(','):$"
"hello, ,world"
[
"hello",
" ",
"world"
]
"$$join('\\''):$"
"hello' 'world"
[
"hello",
" ",
"world"
]
"$$join('$[1]'):$"
"hello   world"
[
"hello",
"world"
]
"$$join( ,<):$"
"<hello world"
[
"hello",
"world"
]
"$$join( ,<,>):$"
"<hello world>"