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

# unwrap

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

## unwrap(text: String, wrapper: String): String

Unwraps a given `text` from a `wrapper` text.

_Introduced in DataWeave version 2.2.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 input string.</p></td></tr><tr><td><p><code>wrapper</code></p></td><td><p>The text used to unwrap.</p></td></tr></tbody></table>

### Example

This example shows how `unwrap` behaves with different inputs and sizes.

#### Source

```DataWeave
%dw 2.0
import unwrap from dw::core::Strings
output application/json
---
{
  "a": unwrap(null, ""),
  "b": unwrap(null, '\0'),
  "c": unwrap("'abc'", "'"),
  "d": unwrap("AABabcBAA", 'A'),
  "e": unwrap("A", '#'),
  "f": unwrap("#A", '#'),
  "g": unwrap("A#", '#')
}
```

#### Output

```JSON
{
   "a": null,
   "b": null,
   "c": "abc",
   "d": "ABabcBA",
   "e": "A",
   "f": "#A",
   "g": "A#"
 }
```

## unwrap(text: Null, wrapper: String): Null

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

_Introduced in DataWeave version 2.2.0._
