# indexOf

Description: indexOf cheatcode documentation

Note: This document was authored using MDX

  Source: https://github.com/NomicFoundation/hardhat-website/tree/main/src/content/docs/docs/reference/cheatcodes/Utilities/index-of.mdx

### Signature

```solidity
function indexOf(
  string calldata input,
  string calldata key
) external pure returns (uint256);
```

### Description

Returns the index of the first occurrence of a `key` in an `input` string.
Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `key` is not found.
Returns 0 in case of an empty `key`.
