แก้ไข

แชร์ผ่าน


StringJoin (NoSQL query)

APPLIES TO: NoSQL

Returns a string, which concatenates the elements of a specified array, using the specified separator between each element.

Syntax

StringJoin(<array_expr>, <string_expr>)

Arguments

Description
array_expr An array expression with all string items inside.
string_expr A string expression to use as the separator.

Return types

Returns a string expression.

Examples

The following example illustrates how to use this function to combine multiple strings.

SELECT VALUE {
  joinUsingSpaces: StringJoin(["Iropa", "Mountain", "Bike"], " "),
  joinUsingEmptyString: StringJoin(["Iropa", "Mountain", "Bike"], ""),
  joinUsingUndefined: StringJoin(["Iropa", "Mountain", "Bike"], undefined),
  joinUsingCharacter: StringJoin(["6", "7", "4", "3"], "A"),
  joinUsingPhrase: StringJoin(["Adventure", "LT"], "Works")
}
[
  {
    "joinUsingSpaces": "Iropa Mountain Bike",
    "joinUsingEmptyString": "IropaMountainBike",
    "joinUsingCharacter": "6A7A4A3",
    "joinUsingPhrase": "AdventureWorksLT"
  }
]

Remarks

  • This system function doesn't utilize the index.