The CONCAT function combines an arbitrarily large number of strings in the order they were provided.

This function takes any number of strings as input. It outputs a single string consisting of all those strings joined together, in the order they were given.

Declaration

CONCAT(string_1, string_2,..., string_n) -> combined_string

 

Parameters

string_n (required, type: string)
The nth string provided as input, where n is any positive integer.
At least one string is required as input in order for CONCAT to run, and at least two strings are required as input in order for the CONCAT function to return output that differs from the input. There is no upper bound to the number of strings that can be used as input and thus no upper bound to n.

Return Values

combined_string (type: string)
The string created by joining all the strings entered as input.

Examples

The following example takes the string "Hello, " and joins it with the string "world!". Note that these strings are joined exactly as they were entered, without anything to indicate where they were once separated. Because we wanted a space between "Hello," and "world!", we inserted it after "Hello," (although we could have just as easily put it in front of "world!"):
CONCAT("Hello, ", "world!") => "Hello, world"
 

In the above example, we hardcoded all the strings we wanted to input into CONCAT, but this does not need to be the case. For subsequent examples, assume all formulas have access to the following variables, stored as strings: 

first_name = "Jane",
last_name = "Doe",
preferred_greeting = "Howdy"
 
The following example takes the string "Hello, " and joins it with the string stored under the variable first_name. Note that hardcoded strings (such as "Hello, ") can be joined with strings stored as variables; quotation marks designate hardcoded strings, whereas a lack of quotation marks designate variables.
CONCAT("Hello, " first_name) -> "Hello, Jane"

 

This last example joins six things: the string stored under the variable preferred_greeting, the string " ", the string stored under the variable first_name, the string " ", the string stored under the variable last_name, and the string "!" Note that the string " " appears twice: the input strings do not need to be unique.

CONCAT(preferred_greeting, " ", first_name, " ", last_name ", !") -> "Howdy, Jane Doe!"

Discussion

The CONCAT function comes from an abbreviation of "concatenate," which means "link things together in a chain or series." In computer programming, string concatenation is the operation of joining character strings end-to-end. The functionality of CONCAT or CONCATENATE functions is fairly standardized, and if you've used either in another programming language, making use of Airscript's CONCAT function should offer few surprises.

Was this article helpful?

0 out of 0 found this helpful

Add comment

Please sign in to leave a comment.