File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public protocol StringProtocol
2121 TextOutputStream , TextOutputStreamable ,
2222 LosslessStringConvertible , ExpressibleByStringLiteral ,
2323 Hashable , Comparable
24- where Iterator. Element == Character {
24+ where Iterator. Element == Character , SubSequence : StringProtocol {
2525
2626 associatedtype UTF8View : /*Bidirectional*/Collection
2727 where UTF8View. Element == UInt8 // Unicode.UTF8.CodeUnit
Original file line number Diff line number Diff line change @@ -18,10 +18,14 @@ extension MyString : BidirectionalCollection {
1818 typealias Iterator = String . Iterator
1919 typealias Index = String . Index
2020 typealias IndexDistance = String . IndexDistance
21+ typealias SubSequence = MyString
2122 func makeIterator( ) -> Iterator { return base. makeIterator ( ) }
2223 var startIndex : String . Index { return base. startIndex }
2324 var endIndex : String . Index { return base. startIndex }
2425 subscript( i: Index ) -> Character { return base [ i] }
26+ subscript( indices: Range < Index > ) -> MyString {
27+ return MyString ( base: String ( self . base [ indices] ) )
28+ }
2529 func index( after i: Index ) -> Index { return base. index ( after: i) }
2630 func index( before i: Index ) -> Index { return base. index ( before: i) }
2731 func index( _ i: Index , offsetBy n: IndexDistance ) -> Index {
You can’t perform that action at this time.
0 commit comments