Skip to content

AH-dark/bytestring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ByteString

A Go library for converting strings to byte slices and vice versa without memory allocation.

Installation

To install the bytestring library, use the go get command:

go get github.com/AH-dark/bs

Usage

The bytestring library provides functions to efficiently convert strings to byte slices and vice versa without memory allocation.

Convert String to Bytes

import "github.com/AH-dark/bytestring/v2"

s := "Hello, World!"
b := bs.StringToBytes(s)

Convert Bytes to String

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)

Running Tests

To run tests, use the go test command in the project directory:

go test -v

Also, you can run benchmarks:

go test -bench=. -benchmem

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

About

A Go library for converting strings to byte slices and vice versa without memory allocation.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages