---
schema_version: "1"
id: b30b509f1b73d45f2e0a7e96e4cdf3dea8f9b179ac870f5054338d4a69e959b1
title: wrapWith
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.8/dw-strings-functions-wrapwith.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.8/dw-strings-functions-wrapwith
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 88021f1d714a5b93a04fcc71f558fffecbf23689e0e0e2cee754d506a11bff19
description: MuleSoft Documentation Site
release: "2.8"
latest: false
---
# wrapWith

## [](#wrapwith1)wrapWith(text: String, wrapper: String): String

指定された ​`text`​ を、指定された ​`wrapper`​ でラップします。

_DataWeave バージョン 2.2.0 で導入されました。_

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>text</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">入力文字列。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>wrapper</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">ラップするために使用するコンテンツ。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、さまざまな入力とサイズでの ​`wrapWith`​ の動作を示します。

#### [](#ソース)ソース

```DataWeave
%dw 2.0
import * from dw::core::Strings
output application/json
---
{
  "a": wrapWith(null, "'"),
  "b": wrapWith("", "'"),
  "c": wrapWith("ab", "x"),
  "d": wrapWith("'ab'", "'"),
  "e": wrapWith("ab", "'")
}
```

#### [](#出力)出力

```JSON
{
  "a": null,
  "b": "''",
  "c": "xabx",
  "d": "''ab''",
  "e": "'ab'"
}
```

## [](#wrapwith2)wrapWith(text: Null, wrapper: Any): Null

`wrapWith`​ を ​`null`​ 値に使用できるようにするヘルパー関数。

_DataWeave バージョン 2.2.0 で導入されました。_