---
schema_version: "1"
id: 1af8051e406b91246c4ece2dbef17d691a42c70fd0fad94618a7088c6acd4261
title: indexOf
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.6/dw-arrays-functions-indexof.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.6/dw-arrays-functions-indexof
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 263ddbd64bf86e5a8b2860f3df917bb1f64c2618b8492c50d0b5800d8d299f52
description: MuleSoft Documentation Site
release: "2.6"
latest: false
---
# indexOf

## [](#indexof1)indexOf<T>(array: Array<T>, toFind: T): Number

配列内で最初に出現する要素のインデックスを返します。値が見つからない場合、​`-1`​ を返します。

_DataWeave バージョン 2.2.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>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>toFind</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">検索する要素。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、入力配列から、一致する値のインデックスを返します。 `"Julian"`​ のインデックスは ​`2`​ です。

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

```DataWeave
%dw 2.0
import * from dw::core::Arrays
output application/json
var users = ["Mariano", "Leandro", "Julian"]
---
indexOf(users, "Julian")
```

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

```json
2
```