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

# 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._
