Skip to content

concat

Description

Joins multiple strings together and return the result as a single string.

Syntax

Like many functions in DataPrime, concat supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.

concat(value: string, ...values: string): string
(value: string).concat(...values: string): string

Arguments

NameTypeRequiredDescription
valuestringtrueThe first string to include in the result
...valuesstringtrueAdditional strings to concatenate, in order

Example

Combine first and last names into a full name.

Consider the following document:

{
    "username": "prime4u",
    "first_name": "Rick",
    "last_name": "Ast",
}

Use concat to build a full_name field:

create full_name from concat(first_name, ' ', last_name)
create full_name from first_name.concat(' ', last_name)

Output

{
    "username": "prime4u",
    "first_name": "Rick",
    "last_name": "Ast",
    "full_name": "Rick Ast"
}