Skip to content

Commit

Permalink
Removed redundant validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmazzei committed Dec 25, 2016
1 parent cf45ebd commit 960bca1
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 12 deletions.
3 changes: 0 additions & 3 deletions Boyer-Moore/BoyerMoore.playground/Contents.swift
Expand Up @@ -9,9 +9,6 @@
*/
extension String {
func index(of pattern: String, usingHorspoolImprovement: Bool = false) -> Index? {
// There are no possible match in an empty string
guard !isEmpty else { return nil }

// 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.characters.count
Expand Down
3 changes: 0 additions & 3 deletions Boyer-Moore/BoyerMoore.swift
Expand Up @@ -7,9 +7,6 @@
*/
extension String {
func index(of pattern: String, usingHorspoolImprovement: Bool = false) -> Index? {
// There are no possible match in an empty string
guard !isEmpty else { return nil }

// 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.characters.count
Expand Down
6 changes: 0 additions & 6 deletions Boyer-Moore/README.markdown
Expand Up @@ -33,9 +33,6 @@ Here's how you could write it in Swift:
```swift
extension String {
func index(of pattern: String) -> Index? {
// There are no possible match in an empty string
guard !isEmpty else { return nil }

// 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.characters.count
Expand Down Expand Up @@ -160,9 +157,6 @@ Here's an implementation of the Boyer-Moore-Horspool algorithm:
```swift
extension String {
func index(of pattern: String) -> Index? {
// There are no possible match in an empty string
guard !isEmpty else { return nil }

// 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.characters.count
Expand Down

0 comments on commit 960bca1

Please sign in to comment.