0
I need to take a user string and check if 1) The first letter begins with i or I 2) The last letter ends with n or N 3) If string theme letter a or A in the middle.
I started writing something like this, and I used the string package but the program keeps giving error
func main() {
var s string
fmt.Println("Type a word")
fmt.Scan(&s)
//procurar na string
verificaA := strings.Contains(s, "A")
verificaa := strings.Contains(s, "a")
num := len(s)
if s[0] == 'i' || s[0] == 'I' {
if s[num-1] == 'n' || s[num-1] == 'N' {
if verificaA == true || verificaa == true {
fmt.Println("Found!")
}
}
} else {
fmt.Println("Not Found!")
}
}
go