go 语言中类型转换

 
0 评论0 浏览

string to int

string转成int: 
int, err := strconv.Atoi(string)
string转成int64: 
int64, err := strconv.ParseInt(string, 10, 64)

string to uint

string转成uint64: 
int64, err := strconv.ParseUint(string, 10, 64)

int to string

int转成string: 
string := strconv.Itoa(int)
int64转成string: 
string := strconv.FormatInt(int64,10)

uint to string

int64转成string: 
string := strconv.FormatUint(int64,10)

标题:go 语言中类型转换
作者:K
地址:https://pala.icu/articles/2019/12/21/1576858798435.html