---
schema_version: "1"
id: b6f73b3c14906f8a6fad10f39a42b28b21ec1e0d992e5813687cdf98e6da6c8b
title: compose
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.5/dw-url-functions-compose.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.5/dw-url-functions-compose
source_site: docs.mulesoft.com
content_type: documentation
content_hash: a244fb74ec39ac07ca5957bb04fc551987873fed5e8cfc791e885b5640f2495a
description: MuleSoft Documentation Site
release: "2.5"
latest: false
---
# compose

## [](#compose1)compose(parts: Array<String>, interpolation: Array<String>): String

カスタム文字列補間値を使用して、URL コンポーネントを ​`encodeURIComponent`​ 結果に置き換えます。この関数は、標準コールまたは簡易バージョンを使用してコールできます。

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

<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>baseStringArray</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>interpolationStringArray</code>​ パラメーターの文字列を使用して補間する URL 部分を含む文字列配列。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>interpolationStringArray</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>baseStringArray</code>​ を補間するために使用される文字列を含む文字列配列。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、compose 関数を使用してエンコードされた URL を形成します。最初のパラメーターは 2 つの文字列から成る配列で、これらは URL の一部です。2 つ目のパラメーターは最初のパラメーターの文字列を補間するために使用される ​`urlPath`​ 変数です。 入力内のスペースは出力 URL では ​`%20`​ にエンコードされます。

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

```DataWeave
%dw 2.0
output application/json
var urlPath = "content folder"
import * from dw::core::URL
---
 { "encodedURL" : compose(["http://examplewebsite.com/", "/page.html"], ["$(urlPath)"]) }
```

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

```JSON
{ "encodedURL" : "http://examplewebsite.com/content%20folder/page.html" }
```

### [](#例-2)例

この関数を簡易構文を使用してコールすることもできます。その場合は、エンコードする変数を含む文字列をバッククォート (`` ` ``) で囲みます。次の例は、簡易構文を使用して前の例と同じ結果を得る方法を示しています。

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

```DataWeave
%dw 2.0
output application/json
var urlPath = "content folder"
import * from dw::core::URL
---
{ "encodedURL" : compose `http://examplewebsite.com/$(urlPath)/page.html`}
```

#### [](#出力-2)出力

```JSON
{ "encodedURL" : "http://examplewebsite.com/content%20folder/page.html" }
```