package transfer
|
|
|
|
import (
|
|
"math"
|
|
"strconv"
|
|
"time"
|
|
)
|
|
|
|
func StringToInt(source string) (data int, err error) {
|
|
return strconv.Atoi(source)
|
|
}
|
|
|
|
func IntToString(source int) (data string) {
|
|
return strconv.Itoa(source)
|
|
}
|
|
|
|
func DecimalToIntAbandon(source float64) (data int) {
|
|
return int(source)
|
|
}
|
|
|
|
func DecimalToIntRound(source float64) (data int) {
|
|
return int(math.Floor(source + 0.5))
|
|
}
|
|
|
|
func DecimalToIntCeil(source float64) (data int) {
|
|
return int(math.Ceil(source))
|
|
}
|
|
|
|
func DecimalToIntFloor(source float64) (data int) {
|
|
return int(math.Floor(source))
|
|
}
|
|
|
|
func TimeToString(source time.Time, format string) (data string) {
|
|
return source.Format(format)
|
|
}
|