We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b200e9a commit c7dd144Copy full SHA for c7dd144
Sources/_StringProcessing/Algorithms/Algorithms/Ranges.swift
@@ -234,7 +234,22 @@ struct RegexRangesCollection<Output> {
234
self.base = RegexMatchesCollection(base: string, regex: regex)
235
}
236
237
+
238
+@available(SwiftStdlib 5.7, *)
239
+extension RegexRangesCollection: Sequence {
240
+ struct Iterator: IteratorProtocol {
241
+ var matchesBase: RegexMatchesCollection<Output>.Iterator
242
243
+ mutating func next() -> Range<String.Index>? {
244
+ matchesBase.next().map(\.range)
245
+ }
246
247
248
+ func makeIterator() -> Iterator {
249
+ Iterator(matchesBase: base.makeIterator())
250
251
+}
252
253
@available(SwiftStdlib 5.7, *)
254
extension RegexRangesCollection: Collection {
255
typealias Index = RegexMatchesCollection<Output>.Index
0 commit comments