range(of:options:in:)
Finds the range of the specified data as a subsequence of this data, if it exists.
Declaration
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
A Range specifying the location of the found data, or nil if a match could not be found.
Discussion
Precondition: range must be in the bounds of the Data.