MCPcopy Create free account
hub / github.com/AudDMusic/RedditBot / minDistance

Function minDistance

main.go:971–987  ·  view source on GitHub ↗
(s, sub1 string, sub2 ...string)

Source from the content-addressed store, hash-verified

969}
970
971func minDistance(s, sub1 string, sub2 ...string) int {
972 if !strings.Contains(s, sub1) {
973 return 0
974 }
975
976 min := math.MaxInt16
977 for i := range sub2 {
978 d, e := distance(s, sub1, sub2[i])
979 if e && d < min && d > 0 {
980 min = d
981 }
982 }
983 if min == math.MaxInt16 {
984 min = 0
985 }
986 return min
987}
988
989func (r *auddBot) Comment(p *models.Comment) {
990 //fmt.Print("c") // why? to test the amount of new comments on Reddit!

Callers 1

CommentMethod · 0.85

Calls 1

distanceFunction · 0.85

Tested by

no test coverage detected