You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
878 B
47 lines
878 B
package util |
|
|
|
import ( |
|
"math" |
|
"strconv" |
|
) |
|
|
|
func IntTransString(i int) string { |
|
return strconv.Itoa(i) |
|
} |
|
|
|
func Int32TarnsString(i int32) string { |
|
return IntTransString(int(i)) |
|
} |
|
|
|
func Int64TarnsString(i int64) string { |
|
return IntTransString(int(i)) |
|
} |
|
|
|
func StringTarnsInt(s string) int { |
|
i, _ := strconv.Atoi(s) |
|
return i |
|
} |
|
|
|
func StringTarnsInt64(s string) int64 { |
|
return int64(StringTarnsInt(s)) |
|
} |
|
|
|
// Float64TarnsInt float64转int |
|
func Float64TarnsInt(i float64) int { |
|
return int(i) |
|
} |
|
|
|
// Float64IncrTarnsInt float64 向上递增转int |
|
func Float64IncrTarnsInt(i float64) int { |
|
return int(math.Ceil(i)) |
|
} |
|
|
|
// Float64DecrTarnsInt float64 向下递增转int |
|
func Float64DecrTarnsInt(i float64) int { |
|
return int(math.Floor(i)) |
|
} |
|
|
|
// Float64IncrTarnsInt32 float64 向上递增转int32 |
|
func Float64IncrTarnsInt32(i float64) int32 { |
|
return int32(Float64IncrTarnsInt(i)) |
|
}
|
|
|