MCPcopy Index your code
hub / github.com/TheAlgorithms/Go / convertToString

Function convertToString

strings/ahocorasick/ahocorasick_test.go:24–37  ·  view source on GitHub ↗
(res Result)

Source from the content-addressed store, hash-verified

22}
23
24func convertToString(res Result) string {
25 var r strings.Builder
26 for key, val := range res.occurrences {
27 r.WriteString(fmt.Sprintf("Word: '%s' at positions: ", key))
28 for i := range val {
29 r.WriteString(fmt.Sprintf("%d", val[i]))
30 if i != len(val)-1 {
31 r.WriteString(", ")
32 }
33 }
34 r.WriteString(". ")
35 }
36 return r.String()
37}

Callers 2

TestAdvancedFunction · 0.85
TestAhoCorasickFunction · 0.85

Calls 1

StringMethod · 0.80

Tested by

no test coverage detected