Answers for "golang check if string exists in slice"

Go
0

golang check if string exists in slice

func contains(s []int, e int) bool {
    for _, a := range s {
        if a == e {
            return true
        }
    }
    return false
}
Posted by: Guest on April-26-2022

Browse Popular Code Answers by Language