19 lines
395 B
Go
19 lines
395 B
Go
2 years ago
|
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!")
|
||
|
}
|
||
|
}
|