---
title: "range(of:options:in:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/data/range(of:options:in:)"
---

# range(of:options:in:)

Finds the range of the specified data as a subsequence of this data, if it exists.

## Declaration

```swift
func range(of dataToFind: Data, options: Data.SearchOptions = [], in range: Range<Data.Index>? = nil) -> Range<Data.Index>?
```

## Parameters

- `dataToFind`: The data to be searched for.
- `options`: Options for the search. Default value is [].
- `range`: The range of this data in which to perform the search. Default value is nil, which means the entire content of this data.

## Return Value

Return Value A Range specifying the location of the found data, or nil if a match could not be found.

## Discussion

Discussion Precondition: range must be in the bounds of the Data.

## See Also

### Finding Bytes

- [Data.SearchOptions](foundation/data/searchoptions.md)
