A Go library for converting strings to byte slices and vice versa without memory allocation.
To install the bytestring
library, use the go get
command:
go get github.com/AH-dark/bs
The bytestring
library provides functions to efficiently convert strings to byte slices and vice versa without memory allocation.
import "github.com/AH-dark/bytestring/v2"
s := "Hello, World!"
b := bs.StringToBytes(s)
import "github.com/AH-dark/bytestring/v2"
b := []byte{72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33}
s := bs.BytesToString(b)
To run tests, use the go test
command in the project directory:
go test -v
Also, you can run benchmarks:
go test -bench=. -benchmem
This project is licensed under the GNU General Public License v3.0 - see the LICENSE
file for details.