3 ms·
Do you have a source for Go having free byte/string conversion? To my knowledge it is a copy. Or maybe I don't get your meaning? I really like the way Go's str
by echlebek 10y ago
Do you have a source for Go having free byte/string conversion? To my knowledge it is a copy. Or maybe I don't get your meaning?
I really like the way Go's strings work. I wish Python's strings worked like this too.
https://play.golang.org/p/a70FEDOxBz https://play.golang.org/p/a70FEDOxBz
- the_mitsuhiko 10y ago> Do you have a source for Go having free byte/string conversion? To my knowledge it is a copy. Or maybe I don't get your meaning? You can access bytes in go out of the string without even having to perform a conversion. For bytes to string you can use the unsafe and reflect package to create strings from bytes without a copy. (You will need to verify utf-8 integrity of course)