Add HasCommand()

This commit is contained in:
Ryan Cavicchioni 2022-08-07 07:12:53 -05:00
parent b852b02aed
commit 1643fef377
Signed by: ryanc
GPG Key ID: 877EEDAF9245103D

View File

@ -45,3 +45,19 @@ func BuildURI(rawuri, rawpath string) string {
u.Path = path.Join(u.Path, rawpath) u.Path = path.Join(u.Path, rawpath)
return u.String() return u.String()
} }
func HasCommand(s, prefix, cmd string) bool {
if len(s) < 2 {
return false
}
if string(s[0]) != prefix {
return false
}
if s[1:] == cmd {
return true
}
return false
}