---
schema_version: "1"
id: 88a46599e1b656b5192d55f97b4eea1d67d217bb4fb2a2ef073aaa2afee435ff
title: substringBy
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.7/dw-strings-functions-substringby.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.7/dw-strings-functions-substringby
source_site: docs.mulesoft.com
content_type: documentation
content_hash: f36a67585697e3ab56fe42caea6da5da27175eb2db85d72ed415a5fa59bb6633
description: MuleSoft Documentation Site
release: "2.7"
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 で導入されました。_