MCPcopy
hub / github.com/go-chi/chi / longestPrefix

Function longestPrefix

tree.go:774–781  ·  view source on GitHub ↗

longestPrefix finds the length of the shared prefix of two strings

(k1, k2 string)

Source from the content-addressed store, hash-verified

772
773// longestPrefix finds the length of the shared prefix of two strings
774func longestPrefix(k1, k2 string) (i int) {
775 for i = 0; i < min(len(k1), len(k2)); i++ {
776 if k1[i] != k2[i] {
777 break
778 }
779 }
780 return
781}
782
783type nodes []*node
784

Callers 2

InsertRouteMethod · 0.85
findPatternMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected