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
21
21
TextOutputStream , TextOutputStreamable ,
22
22
LosslessStringConvertible , ExpressibleByStringLiteral ,
23
23
Hashable , Comparable
24
- where Iterator. Element == Character {
24
+ where Iterator. Element == Character , SubSequence : StringProtocol {
25
25
26
26
associatedtype UTF8View : /*Bidirectional*/Collection
27
27
where UTF8View. Element == UInt8 // Unicode.UTF8.CodeUnit
Original file line number Diff line number Diff line change @@ -18,10 +18,14 @@ extension MyString : BidirectionalCollection {
18
18
typealias Iterator = String . Iterator
19
19
typealias Index = String . Index
20
20
typealias IndexDistance = String . IndexDistance
21
+ typealias SubSequence = MyString
21
22
func makeIterator( ) -> Iterator { return base. makeIterator ( ) }
22
23
var startIndex : String . Index { return base. startIndex }
23
24
var endIndex : String . Index { return base. startIndex }
24
25
subscript( i: Index ) -> Character { return base [ i] }
26
+ subscript( indices: Range < Index > ) -> MyString {
27
+ return MyString ( base: String ( self . base [ indices] ) )
28
+ }
25
29
func index( after i: Index ) -> Index { return base. index ( after: i) }
26
30
func index( before i: Index ) -> Index { return base. index ( before: i) }
27
31
func index( _ i: Index , offsetBy n: IndexDistance ) -> Index {
You can’t perform that action at this time.
0 commit comments