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

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