MCPcopy Index your code
hub / github.com/golang/groupcache / EqualString

Method EqualString

byteview.go:105–119  ·  view source on GitHub ↗

EqualString returns whether the bytes in b are the same as the bytes in s.

(s string)

Source from the content-addressed store, hash-verified

103// EqualString returns whether the bytes in b are the same as the bytes
104// in s.
105func (v ByteView) EqualString(s string) bool {
106 if v.b == nil {
107 return v.s == s
108 }
109 l := v.Len()
110 if len(s) != l {
111 return false
112 }
113 for i, bi := range v.b {
114 if bi != s[i] {
115 return false
116 }
117 }
118 return true
119}
120
121// EqualBytes returns whether the bytes in b are the same as the bytes
122// in b2.

Callers 2

EqualMethod · 0.95
TestByteViewEqualFunction · 0.80

Calls 1

LenMethod · 0.95

Tested by 1

TestByteViewEqualFunction · 0.64