Skip to content

Commit

Permalink
Merge pull request kodecocodes#835 from pakosaldanaort/Fix_Boyer-Moor…
Browse files Browse the repository at this point in the history
…e-Horspool

Fix deprecated methods on Boyer-Moore-Horspool
  • Loading branch information
richard-ash authored Dec 19, 2018
2 parents da92362 + 091f17d commit 61d32c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension String {
// Cache the length of the search pattern because we're going to
// use it a few times and it's expensive to calculate.
let patternLength = pattern.count
guard patternLength > 0, patternLength <= count else { return nil }
guard patternLength > 0, patternLength <= self.count else { return nil }

// Make the skip table. This table determines how far we skip ahead
// when a character from the pattern is found.
Expand Down
4 changes: 2 additions & 2 deletions Boyer-Moore-Horspool/BoyerMooreHorspool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ extension String {
// Cache the length of the search pattern because we're going to
// use it a few times and it's expensive to calculate.
let patternLength = pattern.count
guard patternLength > 0, patternLength <= count else { return nil }

guard patternLength > 0, patternLength <= self.count else { return nil }
// Make the skip table. This table determines how far we skip ahead
// when a character from the pattern is found.
var skipTable = [Character: Int]()
Expand Down

0 comments on commit 61d32c4

Please sign in to comment.