From ff9d94bb72e503a87102fabaf18efe86ab9d01e8 Mon Sep 17 00:00:00 2001 From: Gabriel De Los Rios Date: Sun, 8 Dec 2024 23:02:13 -0300 Subject: [PATCH] feat: adds decimals validator method --- app/utils/validators/validators.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/utils/validators/validators.py b/app/utils/validators/validators.py index a5e5d02..c076831 100644 --- a/app/utils/validators/validators.py +++ b/app/utils/validators/validators.py @@ -9,4 +9,12 @@ class Validators: regex = re.compile(pattern) if(regex.match(string) is not None): return True - return False \ No newline at end of file + return False + + @staticmethod + def is_valid_decimal(value: str): + try: + float(value) + return True + except: + return False \ No newline at end of file