5 ms·
Would it be too hard to just compare arbitrary slices and arrays based on the contents of said data structures? Converting arbitrary bytes to strings should fai
by eptcyka 7y ago
Would it be too hard to just compare arbitrary slices and arrays based on the contents of said data structures?
Converting arbitrary bytes to strings should fail at least some times, since not all byte sequences are valid UTF-8, and afaiu, in Go, the string type should always contain valid UTF-8.
- bakery2k 7y agoI thought strings in Go could contain arbitrary byte sequences?
- nemo1618 7y agoGo strings do not need to contain valid UTF-8, although in practice they usually do. A 'range' loop over a string will loop over its UTF-8 codepoints, but in general, a string can contain arbitrary binary data. See https://golang.org/pkg/builtin/#string https://golang.org/pkg/builtin/#string