Instance Method
firstRange(of:in:)
iOS 8.0+
iPadOS 8.0+
Mac Catalyst 8.0+
macOS 10.10+
tvOS 9.0+
watchOS 2.0+
Returns the first found range of the given data buffer.
func firstRange<D, R>(of: D, in: R) -> Range<Self.Index>? where D : DataProtocol, R : RangeExpression, Self.Index == R.Bound
Parameters
ofThe data sequence to find.
inA range to limit the scope of the search.
Return Value
The range, if found, of the first match of the provided data sequence.
Discussion
A default implementation is given in terms of self.regions.
Default Implementations
DataProtocol Implementations
func firstRange<D, R>(of: D, in: R) -> Range<Self.Index>?Returns the first found range of the type’s data buffer within the specified range.