fix
This commit is contained in:
@@ -2,19 +2,15 @@ package format
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// 厘转美元
|
||||
func CentitoDollar(price int64, remainFloatPoint ...uint) float64 {
|
||||
s := "%.3f"
|
||||
func CentitoDollar(price int64, remainFloatPoint ...uint) string {
|
||||
s := "%0.3f"
|
||||
if len(remainFloatPoint) > 0 {
|
||||
s = fmt.Sprintf("%%.%df", remainFloatPoint[0])
|
||||
s = fmt.Sprintf("%%0.%df", remainFloatPoint[0])
|
||||
}
|
||||
fmt.Println(s)
|
||||
str := fmt.Sprintf(s, float64(price)/float64(1000))
|
||||
dollar, _ := strconv.ParseFloat(str, 64)
|
||||
return dollar
|
||||
return fmt.Sprintf(s, float64(price)/float64(1000))
|
||||
}
|
||||
|
||||
// 厘转美元
|
||||
|
||||
Reference in New Issue
Block a user