From ff4eb232d19fe965eb5d4d460333d2b94e6fd75b Mon Sep 17 00:00:00 2001 From: Inanc Gumus Date: Fri, 8 Feb 2019 11:28:37 +0300 Subject: [PATCH] refactor: loops 02-path-searcher --- .../02-path-searcher/solution/main.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/13-loops/exercises/09-word-finder-exercises/02-path-searcher/solution/main.go b/13-loops/exercises/09-word-finder-exercises/02-path-searcher/solution/main.go index 2fe903b..10fdaed 100644 --- a/13-loops/exercises/09-word-finder-exercises/02-path-searcher/solution/main.go +++ b/13-loops/exercises/09-word-finder-exercises/02-path-searcher/solution/main.go @@ -14,8 +14,6 @@ import ( "strings" ) -const notFound = -1 - func main() { // Get and split the PATH environment variable @@ -34,7 +32,7 @@ func main() { for i, w := range words { q, w = strings.ToLower(q), strings.ToLower(w) - if strings.Index(w, q) != notFound { + if strings.Contains(w, q) { fmt.Printf("#%-2d: %q\n", i+1, w) } }