irt-service/app/helpers/common_helper.py
2023-09-18 14:01:50 +00:00

18 lines
354 B
Python

import re
def boolean_to_int(value: bool) -> int:
if value:
return 1
else:
return 0
def is_float(element: str) -> bool:
try:
float(element)
return True
except ValueError:
return False
def camel_to_snake(camel_string: str) -> str:
return re.sub(r'(?<!^)(?=[A-Z])', '_', camel_string).lower()