---
schema_version: "1"
id: ba383016d23af30c7ed6ae12a552067ad05804fae66d6f0e87e0eb3643e9717f
title: splitWhere
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.3/dw-arrays-functions-splitwhere.md
canonical_url: https://docs.mulesoft.com/dataweave/2.3/dw-arrays-functions-splitwhere
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 331fe587ed943f41d523c1a8fb42312c8eae589611967d81f5dd02db777cb18d
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
---
product: DataWeave
version: 2.3
---

# splitWhere

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

## splitWhere(Array<T>, (item: T) -> Boolean): Pair<Array<T>, Array<T>>

Splits an array into two at the first position where the condition is met.

_Introduced in DataWeave 2.2.0. Supported by Mule 4.2 and later._

### 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 to split.</p></td></tr><tr><td><p><code>condition</code></p></td><td><p>The condition (or expression) used to match an element in 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", "Tomo"]
---
users splitWhere (item) -> item startsWith "Jul"
```

#### Output

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