strings: Contains

Tiny helper to avoid strings.Index(s, sub) != -1

R=rsc, r2, r
CC=golang-dev
https://golang.org/cl/2265044
This commit is contained in:
Brad Fitzpatrick 2010-11-01 14:32:48 -07:00 committed by Rob Pike
parent e8436689ad
commit e198a5086a
11 changed files with 38 additions and 12 deletions

View file

@ -25,7 +25,7 @@ func LookPath(file string) (string, os.Error) {
// (only bypass the path if file begins with / or ./ or ../)
// but that would not match all the Unix shells.
if strings.Index(file, "/") >= 0 {
if strings.Contains(file, "/") {
if canExec(file) {
return file, nil
}