Checking if a character or a substring exists in a string is so simple:
// Contains reports whether findstr is within mainstr.
func Contains(mainstr, findstr string) bool
And a simple example:
package main
import (
"fmt"
"strings"
)
func main() {
message := "My name is Morteza an I love Golang!"
if strings.Contains(message, "Golang") {
fmt.Println("This user is a Gopher :)")
} else {
fmt.Println("Just a simple user :(")
}
}