Contact Us 1-800-596-4880

reverse

reverse(text: String): String

Reverses sequence of characters in a string.

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

text

The string to reverse.

Example

This example shows how reverse behaves with different inputs.

Source

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

Output

{
  "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.