优化金额类数据的处理,限制长度

This commit is contained in:
2024-06-18 16:56:45 +08:00
parent e65ca1d475
commit 2eb35b637f

View File

@@ -8,9 +8,12 @@ def handle_decimal(string):
return ""
string = re.sub(r'[^0-9.]', '', string)
if "." not in string:
return string
front, back = string.rsplit('.', 1)
front = front.replace(".", "")
front = string
back = ""
else:
front, back = string.rsplit('.', 1)
front = front.replace(".", "")
front = front[-16:]
if back:
back = "." + back