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

## [](#collapse1)collapse(text: String): Array<String>

文字列を同じ文字ごとのサブ文字列に分けます。

各サブ文字列には、1 文字、または入力文字列中で隣接している同じ文字が含まれます。空白スペースは文字として扱われます。

_DataWeave バージョン 2.4.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>
</tbody>
</table>

### [](#例)例

次の例では、この関数で文字列を分ける方法を示しています。 空白スペース (" ") は文字として扱われています。

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

```DataWeave
%dw 2.0
import collapse from dw::core::Strings
output application/json
---
collapse("a  b babb a")
```

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

```Json
["a", "  ", "b", " ", "b", "a", "bb", " ", "a"]
```

## [](#collapse2)collapse(text: Null): Null

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

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