Skip to content

Latest commit

 

History

History
40 lines (21 loc) · 336 Bytes

Golang类型转换.md

File metadata and controls

40 lines (21 loc) · 336 Bytes

Golang 类型转换

int 到 string

str := strconv.Itoa(10)

string 到 int

nodePort,_ := strconv.Atoi(nodePortStr)

string 转 byte数组

var data []byte = []byte(str)

反转:

str2 = string(data2[:])

打印结构体

fmt.Printf("%+v\n", zooKeeperInstance)