EqualString returns whether the bytes in b are the same as the bytes in s.
(s string)
| 103 | // EqualString returns whether the bytes in b are the same as the bytes |
| 104 | // in s. |
| 105 | func (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. |