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

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