refactor: loops 02-path-searcher

This commit is contained in:
Inanc Gumus
2019-02-08 11:28:37 +03:00
parent 59a5681a41
commit ff4eb232d1

View File

@ -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)
}
}