github.com/gopherjs/gopherjs@v1.19.0-beta1.0.20240506212314-27071a8796e4/compiler/natives/src/internal/bytealg/bytealg.go (about) 1 //go:build js 2 // +build js 3 4 package bytealg 5 6 func Equal(a, b []byte) bool { 7 if len(a) != len(b) { 8 return false 9 } 10 for i, c := range a { 11 if c != b[i] { 12 return false 13 } 14 } 15 return true 16 } 17 18 func IndexByte(b []byte, c byte) int { 19 for i, x := range b { 20 if x == c { 21 return i 22 } 23 } 24 return -1 25 } 26 27 func IndexByteString(s string, c byte) int { 28 for i := 0; i < len(s); i++ { 29 if s[i] == c { 30 return i 31 } 32 } 33 return -1 34 }