Skip to content

Commit

Permalink
Updating how String can be casted into an Array.
Browse files Browse the repository at this point in the history
Just wanted to update the syntax from Array(self.characters) to Array(self). Similarly for casting of the ptnr String.
  • Loading branch information
RobertoEfrainHernandez authored Jun 11, 2020
1 parent 9aa3608 commit 9bc6aad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Knuth-Morris-Pratt/KnuthMorrisPratt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ extension String {

func indexesOf(ptnr: String) -> [Int]? {

let text = Array(self.characters)
let pattern = Array(ptnr.characters)
let text = Array(self)
let pattern = Array(ptnr)

let textLength: Int = text.count
let patternLength: Int = pattern.count
Expand Down

0 comments on commit 9bc6aad

Please sign in to comment.