diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/str.go | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -131,3 +131,13 @@ func StrToUpper(s string) string { } return us } + +// Returns true if string 's' has string 'n' in it. +func StrHas(s, n string) bool { + for i := 0; i < len(s); i++ { + if s[i:i+len(n)] == n { + return true + } + } + return false +} |