TEXTJOIN

TEXTJOIN joins strings or arrays of strings using a specified delimiter.

Function category: Text

Syntax

TEXTJOIN(arg1, arg2, arg3, [arg4])

Arguments

Description

arg1

Delimiter used to join text.

arg2

A boolean value which determines if TEXTJOIN ignores empty string values.

arg3

String or array of strings.

arg4

Optional. String or array of strings.

Examples

Let's say we're given a response with the following list of car manufacturers for a given part.

{
"data":{
"parts":{
"part_1":[
"Toyota",
"Hyundai",
"Kia",
"Mercedes Benz"
],
"part_2":[
"BMW",
"",
"Mercedes Benz",
"",
"Ford",
"",
"Tesla"
]
}
}
}

Example 1: Compile a more readable version of an array of values.

If we want to compile an easier to read version of the distributors for a given part, use the following function.

# Compile to a readable version of parts
TEXTJOIN(", ", TRUE, data.parts.part_1)
# Returns "Toyota, Hyundai, Kia, Mercedes Benz"

Example 2: Ignore empty string values

If we try to parse part_2 with arg2 set to true, it will remove any blanks.

# Ignore empty string values
TEXTJOIN(", ", TRUE, data.parts.part_2)
# Returns "BMW, Mercedes Benz, Ford, Tesla"

Example 3: Don't ignore empty string values

If we try to parse part_2 with arg2 set to FALSE, it will retain any blanks:

# Include empty string values
TEXTJOIN(", ", FALSE, data.parts.part_2)
# Returns "BMW, , Mercedes Benz, , Ford, , Tesla"