---
schema_version: "1"
id: 2b4804b1b07d6adf45caf0df4af7b280dae6b87aacf9ed1abe913325f55fbef1
title: reverse
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.6/dw-strings-functions-reverse.md
canonical_url: https://docs.mulesoft.com/dataweave/2.6/dw-strings-functions-reverse
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 91fbe602ab2156a32edd1a8c75e9b28f17563cc241af672269e548cd19bde3a8
description: MuleSoft Documentation Site
release: "2.6"
latest: false
---
---
product: DataWeave
version: 2.6
---

# reverse

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

## reverse(text: String): String

Reverses sequence of characters in a string.

_Introduced in DataWeave version 2.4.0._

### 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 string to reverse.</p></td></tr></tbody></table>

### Example

This example shows how `reverse` behaves with different inputs.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Strings
output application/json
---
 {
     a: reverse("Mariano"),
     b: reverse(null),
     c: reverse("")
 }
```

#### Output

```Json
{
  "a": "onairaM",
  "b": null,
  "c": ""
}
```

## reverse(text: Null): Null

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

_Introduced in DataWeave version 2.4.0._
