You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
395 B
Go
19 lines
395 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
func main() {
|
|
var userInput string
|
|
fmt.Println("Please submit a string and I will check if it begins with 'i', ends in 'n' and contains an 'a':")
|
|
fmt.Scan(&userInput)
|
|
|
|
if strings.HasPrefix(userInput, "i") && strings.HasSuffix(userInput, "n") && strings.Contains(userInput, "a") {
|
|
fmt.Println("Found!")
|
|
} else {
|
|
fmt.Println("Not Found!")
|
|
}
|
|
}
|