---
schema_version: "1"
id: ce48817e78ad95a92ca1d35f5bc126fd5dbaee4759e58fae11a6543d66957884
title: splitAt
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.11/dw-arrays-functions-splitat.md
canonical_url: https://docs.mulesoft.com/dataweave/2.11/dw-arrays-functions-splitat
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 3cfd7c13db5890ae79fb8cbeb6208df6e08b6037cffe9a52a27649287b5e4ee8
description: MuleSoft Documentation Site
release: "2.11"
latest: false
---
---
product: DataWeave
version: 2.11
---

# splitAt

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## splitAt<T>(array: Array<T>, n: Number): Pair<Array<T>, Array<T>>

Splits an array into two at a given position.

_Introduced in DataWeave version 2.2.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>array</code></p></td><td><p>The array of elements.</p></td></tr><tr><td><p><code>n</code></p></td><td><p>The index at which to split the array.</p></td></tr></tbody></table>

### Example

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Arrays
output application/json
var users = ["Mariano", "Leandro", "Julian"]
---
users splitAt 1
```

#### Output

```json
{
  "l": ["Mariano"],
  "r": ["Leandro", "Julian"]
}
```

## splitAt(array: Null, n: Any): Null

Helper function that enables `splitAt` to work with a `null` value.

_Introduced in DataWeave version 2.4.0._
