Rediger

Del via


StringSplit (NoSQL query)

APPLIES TO: NoSQL

Returns an array of substrings obtained from separating the source string by the specified delimiter.

Syntax

StringSplit(<string_expr1>, <string_expr2>)

Arguments

Description
string_expr1 The source string expression to parse.
string_expr2 The string used as the delimiter.

Return types

Returns an array expression.

Examples

The following example illustrates how to use this function to split a string.

SELECT VALUE {
  seperateOnLetter: StringSplit("Handlebar", "e"),
  seperateOnSymbol: StringSplit("CARBON_STEEL_BIKE_WHEEL", "_"),
  seperateOnWhitespace: StringSplit("Road Bike", " "),
  seperateOnPhrase: StringSplit("xenmoun mountain bike", "moun"),
  undefinedSeperator: StringSplit("AluminumBikeFrame", undefined),
  emptySeparatorString: StringSplit("Helmet", ""),
  emptySourceString: StringSplit("", "")
}
[
  {
    "seperateOnLetter": [
      "Handl",
      "bar"
    ],
    "seperateOnSymbol": [
      "CARBON",
      "STEEL",
      "BIKE",
      "WHEEL"
    ],
    "seperateOnWhitespace": [
      "Road",
      "Bike"
    ],
    "seperateOnPhrase": [
      "xen",
      " ",
      "tain bike"
    ],
    "emptySeparatorString": [
      "Helmet"
    ],
    "emptySourceString": [
      ""
    ]
  }
]

Remarks

  • This system function doesn't utilize the index.