Skip to content

arraySplit - Splits string into array of tokens

arraySplit will split a string on some delimiter, and return the array of each split component of the string.

Syntax

arraySplit(string: string, delimiter: regexp | string): array<string>

Arguments

NameTypeRequiredDescription
stringstringtrueThe string to split into an array
delimiterregexpstringtrue

Example - Parse first & last name from full name

Consider the following document:

{
    "name": "Chris Cooney"
}

We may wish to break up this name, so that we can track family name and look for similarities across documents:

create first_name from name.arraySplit(' ')[0]
| create last_name from name.arraySplit(' ')[1]

This results in the following document:

{
    "name": "Chris Cooney",
    "first_name": "Chris",
    "last_name": "Cooney"
}