@@ -38,13 +38,13 @@ extension String {
38
38
func index (of pattern : String ) -> Index ? {
39
39
// Cache the length of the search pattern because we're going to
40
40
// use it a few times and it's expensive to calculate.
41
- let patternLength = pattern.characters . count
42
- guard patternLength > 0 , patternLength <= characters. count else { return nil }
41
+ let patternLength = pattern.count
42
+ guard patternLength > 0 , patternLength <= count else { return nil }
43
43
44
44
// Make the skip table. This table determines how far we skip ahead
45
45
// when a character from the pattern is found.
46
46
var skipTable = [Character : Int ]()
47
- for (i, c) in pattern.characters . enumerated () {
47
+ for (i, c) in pattern.enumerated () {
48
48
skipTable[c] = patternLength - i - 1
49
49
}
50
50
@@ -162,13 +162,13 @@ extension String {
162
162
func index (of pattern : String ) -> Index ? {
163
163
// Cache the length of the search pattern because we're going to
164
164
// use it a few times and it's expensive to calculate.
165
- let patternLength = pattern.characters . count
165
+ let patternLength = pattern.count
166
166
guard patternLength > 0 , patternLength <= characters.count else { return nil }
167
167
168
168
// Make the skip table. This table determines how far we skip ahead
169
169
// when a character from the pattern is found.
170
170
var skipTable = [Character : Int ]()
171
- for (i, c) in pattern.characters . enumerated () {
171
+ for (i, c) in pattern.enumerated () {
172
172
skipTable[c] = patternLength - i - 1
173
173
}
174
174
0 commit comments