Contents

firstRange(of:)

Finds and returns the range of the first occurrence of a given collection within this collection.

Declaration

func firstRange<C>(of other: C) -> Range<Self.Index>? where C : Collection, Self.Element == C.Element

Parameters

  • other:

    The collection to search for.

Return Value

A range in the collection of the first occurrence of sequence. Returns nil if sequence is not found.