Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

TEXTJOIN

Dan Gorman edited this page Nov 29, 2018 · 2 revisions

The TEXTJOIN Function

Function Group: Text

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

Syntax

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

  • arg1 is the delimiter to use to join text
  • arg2 is a boolean value, which determines whether TEXTJOIN will ignore empty string values
  • arg3 is a string or an array of strings
  • arg4 is optional, and is also a string or an array of strings

Uses

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 TEXTJOIN: TEXTJOIN(", ", TRUE, data.parts.part_1)

This would return "Toyota, Hyundai, Kia, Mercedes Benz".

Other Examples

If we try to parse the second example with the second argument set to true, it will come out with those blanks:

TEXTJOIN(", ", TRUE, data.parts.part_2) => "BMW, Mercedes Benz, Ford, Tesla"

But with the second argument as false, we'll get this:

TEXTJOIN(", ", FALSE, data.parts.part_2) => "BMW, , Mercedes Benz, , Ford, , Tesla"

Clone this wiki locally