package convertx import "strconv" func Int642String(i int64) string { return strconv.FormatInt(i, 10) } func String2Float64(s string, defValue ...float64) float64 { f64, err := strconv.ParseFloat(s, 64) if err != nil { return defValue[0] } return f64 } func String2Int(s string, defValue ...int) int { i64, err := strconv.Atoi(s) if err != nil { return defValue[0] } return i64 } func String2Int64(s string, defValue ...int64) int64 { i64, err := strconv.ParseInt(s, 10, 64) if err != nil { return defValue[0] } return i64 }