# IndexOf

> Returns the index of the first occurence of another StringView within this one.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.Search](/engine/6000.5/script-reference/unityeditor/search.md)
* **Assembly:** UnityEditor

## IndexOf(StringView, StringComparison)

Returns the index of the first occurence of another [StringView](/engine/6000.5/script-reference/unityeditor/search/stringview.md) within this one.

```csharp
public int IndexOf(StringView other, StringComparison sc = StringComparison.Ordinal)
```

### Parameters

**** (\[StringView]\(/engine/6000.5/script-reference/unityeditor/search/stringview)): A [StringView](/engine/6000.5/script-reference/unityeditor/search/stringview.md).**** (\[StringComparison]\(https\://learn.microsoft.com/dotnet/api/system.stringcomparison)): A string comparision option.

### Returns

| Type                                                       | Description                                                                                                                      |
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The first index where the [StringView](/engine/6000.5/script-reference/unityeditor/search/stringview.md) is found, otherwise -1. |

## IndexOf(string, StringComparison)

Returns the index of the first occurence of another [StringView](/engine/6000.5/script-reference/unityeditor/search/stringview.md) within this one.

```csharp
public int IndexOf(string other, StringComparison sc = StringComparison.Ordinal)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): A [StringView](/engine/6000.5/script-reference/unityeditor/search/stringview.md).**** (\[StringComparison]\(https\://learn.microsoft.com/dotnet/api/system.stringcomparison)): A string comparision option.

### Returns

| Type                                                       | Description                                                                                                                      |
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The first index where the [StringView](/engine/6000.5/script-reference/unityeditor/search/stringview.md) is found, otherwise -1. |

## IndexOf(char, StringComparison)

Returns the index of the first occurence of another [StringView](/engine/6000.5/script-reference/unityeditor/search/stringview.md) within this one.

```csharp
public int IndexOf(char other, StringComparison sc = StringComparison.Ordinal)
```

### Parameters

**** (\[char]\(https\://learn.microsoft.com/dotnet/api/system.char)): A [StringView](/engine/6000.5/script-reference/unityeditor/search/stringview.md).**** (\[StringComparison]\(https\://learn.microsoft.com/dotnet/api/system.stringcomparison)): A string comparision option.

### Returns

| Type                                                       | Description                                                                                                                      |
| ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The first index where the [StringView](/engine/6000.5/script-reference/unityeditor/search/stringview.md) is found, otherwise -1. |
