@@ -1213,3 +1213,12 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
}
return
+func CountDecimalPlaces(num float64) int {
+ str := fmt.Sprintf("%f", num) // 将浮点数转换为字符串
+ dotIndex := strings.Index(str, ".") // 查找小数点的位置
+ if dotIndex == -1 {
+ return 0 // 没有小数点,返回0
+ }
+ decimalPlaces := len(str) - dotIndex - 1 // 计算小数位数
+ return decimalPlaces
+}