Merge branch 'develop' into feature/mhw-v1.01

This commit is contained in:
laodaming
2023-09-21 11:15:56 +08:00
19 changed files with 305 additions and 84 deletions

View File

@@ -6,8 +6,13 @@ import (
)
// 厘转美元
func CentitoDollar(price int64) float64 {
str := fmt.Sprintf("%.3f", float64(price)/float64(1000))
func CentitoDollar(price int64, remainFloatPoint ...uint) float64 {
s := "%.3f"
if len(remainFloatPoint) > 0 {
s = fmt.Sprintf("%%.%df", remainFloatPoint[0])
}
fmt.Println(s)
str := fmt.Sprintf(s, float64(price)/float64(1000))
dollar, _ := strconv.ParseFloat(str, 64)
return dollar
}