优化金额类数据的处理,限制长度
This commit is contained in:
@@ -8,9 +8,12 @@ def handle_decimal(string):
|
|||||||
return ""
|
return ""
|
||||||
string = re.sub(r'[^0-9.]', '', string)
|
string = re.sub(r'[^0-9.]', '', string)
|
||||||
if "." not in string:
|
if "." not in string:
|
||||||
return string
|
front = string
|
||||||
front, back = string.rsplit('.', 1)
|
back = ""
|
||||||
front = front.replace(".", "")
|
else:
|
||||||
|
front, back = string.rsplit('.', 1)
|
||||||
|
front = front.replace(".", "")
|
||||||
|
|
||||||
front = front[-16:]
|
front = front[-16:]
|
||||||
if back:
|
if back:
|
||||||
back = "." + back
|
back = "." + back
|
||||||
|
|||||||
Reference in New Issue
Block a user