---
schema_version: "1"
id: 8df9a73fc73ef53889dcfd5c031bb968f0d617ac0256ef8503c2c56c36f80879
title: substringBy
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.8/dw-strings-functions-substringby.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.8/dw-strings-functions-substringby
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 05c775c32eafd5c6522326347ce68dac5a22df1aa7edb48a502d88b080a4849c
description: MuleSoft Documentation Site
release: "2.8"
latest: false
---
# substringBy

## [](#substringby1)substringBy(text: String, predicate: (character: String, index: Number) -> Boolean): Array<String>

`predicate`​ 式が ​`true`​ を返すそれぞれの文字で文字列を分割します。

_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>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>predicate</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">各文字をテストして Boolean (ブール) 値を返す式。式は文字列の各文字およびインデックスを反復処理できます。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、指定された文字 (`"~"`、 `"="`、または `"_"`) が存在する場所で文字列を分割します。

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

```DataWeave
%dw 2.0
import substringBy from dw::core::Strings
output application/json
---
"hello~world=here_data-weave" substringBy $ == "~" or $ == "=" or $ == "_"
```

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

```Json
["hello", "world", "here", "data-weave"]
```

## [](#substringby2)substringBy(text: Null, predicate: (character: Nothing, index: Nothing) -> Any): Null

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

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