Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Farray%2Farraysplit.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Farray%2Farraysplit.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# `arraySplit`

## Description

Returns an array of substrings by splitting a string using the specified delimiter.

* The delimiter can be either a `string` or a `regexp`.

## Syntax

Like many functions in DataPrime, `arraySplit` supports<!-- --> [two notations](https://docs-docusaurus.kinsta.page/dataprime/language-reference/functions-reference/.md),<!-- --> **function** and **method**. These interchangeable forms allow flexibility in how you structure expressions.

* Function notation
* Method notation

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

```
(string: string).arraySplit(delimiter: regexp | string): array<string>
```

## Arguments

| Name        | Type               | Required | Description                            |
| ----------- | ------------------ | -------- | -------------------------------------- |
| `string`    | `string`           | **true** | The string to split                    |
| `delimiter` | `regexp \| string` | **true** | The delimiter used to split the string |

## Example

**Use case: Extract first and last names from a full name**

Suppose you have a field containing a full name. Consider the following input:

```
{

    "name": "Al Gorithm"

}
```

By splitting the `name` field on a space, you can extract the first and last names into separate fields.

### Example query

* Function notation
* Method notation

```
create first_name from arraySplit(name, ' ')[0]

| create last_name from arraySplit(name, ' ')[1]
```

```
create first_name from name.arraySplit(' ')[0]

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

### Example output

The result will include new fields for the first and last names:

```
{

    "name": "Al Gorithm",

    "first_name": "Al",

    "last_name": "Gorithm"

}
```
