contains(_:)
Returns a Boolean value indicating whether the given closed range is contained within this closed range.
Declaration
func contains(_ other: ClosedRange<Bound>) -> BoolParameters
- other:
A closed range to check for containment within this closed range.
Return Value
true if other is wholly contained within this closed range; otherwise, false.
Discussion
The given closed range is contained within this range if its bounds are contained within this closed range.
let range = 0...10
range.contains(2...5) // true
range.contains(2...10) // true
range.contains(2...12) // false