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