---
schema_version: "1"
id: 98ad31c18fb84a03442e0219f85d61db8599df7656d23b24b553cf8673f93915
title: indexOf
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.4/dw-arrays-functions-indexof.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.4/dw-arrays-functions-indexof
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 8043d85751a9b247810f94ce07fb81eede72b76a867ba8cc5b46834542d2c170
description: MuleSoft Documentation Site
release: "2.4"
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
```