---
schema_version: "1"
id: 879baba2380ff5d01d118f01091bfa5dc0031a7248d9abbb26a2c9cbba9f2f47
title: startsWith
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.12/dw-core-functions-startswith.md
canonical_url: https://docs.mulesoft.com/dataweave/2.12/dw-core-functions-startswith
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 61b55bc9775a409052efd01c9b2fb2b316588dac116045092df86f06e430ac78
description: MuleSoft Documentation Site
release: "2.12"
latest: false
---
---
product: DataWeave
version: 2.12
---

# startsWith

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

## startsWith(text: String, prefix: String): Boolean

Returns `true` or `false` depending on whether the input string starts with a matching prefix.

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>text</code></p></td><td><p>The input string.</p></td></tr><tr><td><p><code>prefix</code></p></td><td><p>A string that identifies the prefix.</p></td></tr></tbody></table>

### Example

This example indicates whether the strings start with a given prefix. Note that you can use the
`startsWith(text,prefix)` or `text startsWith(prefix)` notation (for example,
`startsWith("Mari","Mar")` or `"Mari" startsWith("Mar")`).

#### Source

```DataWeave
%dw 2.0
output application/json
---
[ "Mari" startsWith("Mar"), "Mari" startsWith("Em") ]
```

#### Output

```JSON
[ true, false ]
```

## startsWith(text: Null, prefix: Any): false

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

_Introduced in DataWeave version 2.4.0._
