Skip to content

Instance MethodFoundationEssentials

lastRange(of:in:)

iOS 8.0+ iPadOS 8.0+ Mac Catalyst 8.0+ macOS 10.10+ tvOS 9.0+ watchOS 2.0+
Returns the last found range of the type’s data buffer within the specified range.
func lastRange<D, R>(of data: D, in range: R) -> Range<Self.Index>? where D : DataProtocol, R : RangeExpression, Self.Index == R.Bound

Parameters

data

The data sequence to find.

range

A range to limit the scope of the search.

Return Value

The range, if found, of the last match of the provided data sequence.