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

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

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

_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>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
```