Golang字符串与字节数组互相转换
Golang 大约 246 字[]byte()
字符串转字节数组
str := "Hello Golang"
fmt.Println([]byte(str))
// [72 101 108 108 111 32 71 111 108 97 110 103]
string()
字节数组转字符串
bytes := []byte{72, 101, 108, 108, 111, 32, 71, 111, 108, 97, 110, 103}
fmt.Println(string(bytes))
// Hello Golang
阅读 349 · 发布于 2020-10-31
————        END        ————
扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
HTML中script标签中的async和defer的区别阅读 647
-
Redis运行统计信息阅读 510
-
OpenResty中模板渲染引擎lua-resty-template阅读 1862
-
Redis Cluster搭建阅读 705
-
Spring Boot NoClassDefFoundError: com/mongodb/connection/DefaultClusterFactory阅读 364
-
PostgreSQL数据库角色管理阅读 567
-
前端Chrome反《反调试》阅读 1378
-
MongoDB uri连接规则阅读 953
-
设计模式之代理模式阅读 388
-
Android ScrollView滑动到底部阅读 1089