Choose Category
sort.SearchStrings(sliceName, "value to search")
import ( "fmt" "sort" ) func main() { personNameSlice := make([]string, 0) personNameSlice = append(personNameSlice, "hello") personNameSlice = append(personNameSlice, "world") searchedIndex := sort.SearchStrings(personNameSlice, "world") if searchedIndex < len(personNameSlice) { fmt.Printf("Element is found in index %d \n", searchedIndex) } else { fmt.Printf("Element not found") } }