Skip to content

Commit 6ead6d0

Browse files
committedOct 26, 2018
Update README to use Swift 4.2
1 parent 402f236 commit 6ead6d0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎Boyer-Moore-Horspool/README.markdown

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ extension String {
3838
func index(of pattern: String) -> Index? {
3939
// Cache the length of the search pattern because we're going to
4040
// 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 }
4343

4444
// Make the skip table. This table determines how far we skip ahead
4545
// when a character from the pattern is found.
4646
var skipTable = [Character: Int]()
47-
for (i, c) in pattern.characters.enumerated() {
47+
for (i, c) in pattern.enumerated() {
4848
skipTable[c] = patternLength - i - 1
4949
}
5050

@@ -162,13 +162,13 @@ extension String {
162162
func index(of pattern: String) -> Index? {
163163
// Cache the length of the search pattern because we're going to
164164
// use it a few times and it's expensive to calculate.
165-
let patternLength = pattern.characters.count
165+
let patternLength = pattern.count
166166
guard patternLength > 0, patternLength <= characters.count else { return nil }
167167

168168
// Make the skip table. This table determines how far we skip ahead
169169
// when a character from the pattern is found.
170170
var skipTable = [Character: Int]()
171-
for (i, c) in pattern.characters.enumerated() {
171+
for (i, c) in pattern.enumerated() {
172172
skipTable[c] = patternLength - i - 1
173173
}
174174

0 commit comments

Comments
 (0)
Please sign in to comment.