---
schema_version: "1"
id: 5eb98443d2cb66ddc86260fd7c2a911b555f1484911365222143f21dd6108dae
title: slice
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.3/dw-arrays-functions-slice.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.3/dw-arrays-functions-slice
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 97721228a34fa95c8f2da3a706666507d5db6c4732b16bdce7166384a755e506
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
# slice

## [](#slice1)slice(Array<T>, Number, Number): Array<T>

条件 (​`from <= indexOf(array) < until`​) を満たす要素の間隔を選択します。

_DataWeave 2.2.0 で導入されました。Mule 4.2 以降でサポートされます。_​

### [](#パラメーター)パラメーター

<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>array</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">配列内の含める要素の間隔の開始インデックス。<br>
値が負数の場合、配列の最初の要素から含めます。この値が配列の最後のインデックスよりも大きい場合、関数は空の配列 (​<code>[]</code>​) を返します。</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">配列内の含める要素の間隔の終了インデックス。<br>
この値が配列の最後のインデックスよりも大きい場合、配列の最後の要素まで含めます。この値が配列の最初のインデックスよりも小さい場合、関数は空の配列 (​<code>[]</code>​) を返します。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、入力配列からインデックス 1、2、3 の値を含む配列を返します。インデックス 0、4、5 の値は除外されます。

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

```DataWeave
%dw 2.0
import * from dw::core::Arrays
output application/json
var arr = [0,1,2,3,4,5]
---
slice(arr, 1, 4)
```

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

```json
[
  1,
  2,
  3
]
```