Oihana PHP Arango

concatSeparator.php

Table of Contents

Functions

concatSeparator()  : string
Concatenate strings using a separator.

Functions

concatSeparator()

Concatenate strings using a separator.

concatSeparator([string $separator = Char::EMPTY ][, array<string|int, mixed>|string|null $arguments = null ]) : string

This helper wraps the ArangoDB AQL function CONCAT_SEPARATOR(separator, value1, value2, ... valueN) which concatenates multiple values into a single string using the specified separator between each value.

Example AQL usage:

CONCAT_SEPARATOR(", ", "a", "b", "c")     // returns "a, b, c"
CONCAT_SEPARATOR(" - ", doc.first, doc.last)  // returns "John - Doe"
CONCAT_SEPARATOR("", "a", "b", "c")       // returns "abc" (no separator)
Parameters
$separator : string = Char::EMPTY

The separator string to use between values.

$arguments : array<string|int, mixed>|string|null = null

An AQL string expression or an array of AQL values.

Tags
throws
UnsupportedOperationException
example
use function oihana\arango\db\functions\strings\concatSeparator;

$expr = concatSeparator('", "', ['"a"', '"b"', '"c"']);
// Produces: 'CONCAT_SEPARATOR(", ", "a", "b", "c")'
see
https://docs.arangodb.com/stable/aql/functions/string/#concat_separator
concat()

For concatenating without a separator.

since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results