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

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

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

_DataWeave 2.2.0 で導入されました。Mule 4.2 以降でサポートされます。_​

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

<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(Null, String): Null

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