标签:字符 类型转换 pre nbsp print int UNC col color
func main() { s := "Hello" b := []byte(s) fmt.Println(len(b), cap(b)) fmt.Println(b) }
5 8
[72 101 108 108 111]
//字符串转换为字节
[]byte(s)
[]byte
转换为 string 转换语法为string(bs)
标签:字符 类型转换 pre nbsp print int UNC col color
原文地址:https://www.cnblogs.com/kevin-yang123/p/14827678.html