package main
import (
"fmt"
)
func FindSimilarData(input string, data ...string) string {
same := ""
for _, d := range data {
fmt.Println(d)
if (d) == input {
same += d
fmt.Println(d)
fmt.Println(same)
}
}
return ""
}
func main() {
fmt.Println(FindSimilarData("iphone", "laptop", "iphone 13", "iphone 12", "iphone 12 pro"))
}
expect output is : iphone 13,iphone 12, iphone 12 pro
i want to return the data type string which has similar data, i was trying to use strings.Contains but it only returns the boolean type. can anyone give an example for this one, thanks before