1、string 转为[]byte

var str string = "const.net.cn"
var data []byte = []byte(str)

2、byte转为string

var data [5]byte 
byte[0] = 'c'
byte[1] = 'o'
byte[2] = 'n'
byte[3] = 's'
byte[4] = 't'
var str string = string(data[:])
本文链接地址:https://const.net.cn/16.html

标签: none

添加新评论