|
@@ -1229,6 +1229,9 @@ func changePointDecimalPlaces(str string, changeNum int) (newStr string) {
|
|
}
|
|
}
|
|
dotIndex := strings.Index(str, ".") // 查找小数点的位置
|
|
dotIndex := strings.Index(str, ".") // 查找小数点的位置
|
|
if dotIndex == -1 {
|
|
if dotIndex == -1 {
|
|
|
|
+ if changeNum > 0 { // 增加小数位数
|
|
|
|
+ newStr += "." + strings.Repeat("0", changeNum)
|
|
|
|
+ }
|
|
return // 没有小数点,返回0
|
|
return // 没有小数点,返回0
|
|
}
|
|
}
|
|
decimalPlaces := len(str) - dotIndex - 1 // 计算小数位数
|
|
decimalPlaces := len(str) - dotIndex - 1 // 计算小数位数
|