unsafe

package
v2.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2023 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToStr

func BytesToStr(b []byte) string

BytesToStr It doesn't copy the data, so it's more quickly.

Example
package main

import (
	"fmt"
	"github.com/CarsonSlovoka/go-pkg/v2/unsafe"
)

func main() {
	var s string
	s = unsafe.BytesToStr([]byte("hello"))
	fmt.Println(s)
}
Output:

hello

func StrToBytes

func StrToBytes(s string) []byte

StrToBytes It doesn't copy the data, so it's more quickly.

Example
package main

import (
	"fmt"
	"github.com/CarsonSlovoka/go-pkg/v2/unsafe"
)

func main() {
	var bs []byte
	bs = unsafe.StrToBytes("hello")
	fmt.Printf("%v", bs)
}
Output:

[104 101 108 108 111]

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL