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

## [](#substring1)substring(text: String, from: Number, until: Number): String

指定された ​`from`​ インデックスの文字から ​`until`​ インデックスの前の最後の文字までのサブ文字列を返します。

サブ文字列内の文字は条件 ​`from <= indexOf(string) < until`​ を満たします。

_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>from</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>until</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">文字配列から除外する最も低いインデックス。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、入力配列内の ​`1`​ インデックスから ​`4`​ インデックスまでの文字が含まれるサブ文字列を返します。

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

```DataWeave
%dw 2.0
import * from dw::core::Strings
output application/json
var text = "hello world!"
---
substring(text, 1, 5)
```

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

```json
"ello"
```

## [](#substring2)substring(text: Null, from: Any, until: Any): Null

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

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