string , int 互換
i, err := strconv.Atoi("-42")
s := strconv.Itoa(-42)
string convert to bool, float64, int64, uint64
b, err := strconv.ParseBool("true")
f, err := strconv.ParseFloat("3.1415", 64)
i, err := strconv.ParseInt("-42", 10, 64)
u, err := strconv.ParseUint("42", 10, 64)
bool, float64, int64, unit64 convert to string
s := strconv.FormatBool(true)
s := strconv.FormatFloat(3.1415, 'E', -1, 64)
s := strconv.FormatInt(-42, 16)
s := strconv.FormatUint(42, 16)
文章標籤
全站熱搜