1 Star 0 Fork 0

笑看风云 / gocodes

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
convert.go 188 Bytes
一键复制 编辑 原始数据 按行查看 历史
笑看风云 提交于 2021-11-29 10:40 . 添加datax
package binaryx
import "unsafe"
func StringToBytes(s string) []byte {
x := (*[2]uintptr)(unsafe.Pointer(&s))
h := [3]uintptr{x[0], x[1], x[1]}
return *(*[]byte)(unsafe.Pointer(&h))
}
Go
1
https://gitee.com/zhongguo168a/gocodes.git
git@gitee.com:zhongguo168a/gocodes.git
zhongguo168a
gocodes
gocodes
46752958e769

搜索帮助