mirror of
https://github.com/soxoj/maigret.git
synced 2026-05-07 06:24:35 +00:00
Refactoring: updated data & sites storing, tests added
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import re
|
||||
|
||||
|
||||
class CaseConverter:
|
||||
@staticmethod
|
||||
def camel_to_snake(camelcased_string: str):
|
||||
return re.sub(r'(?<!^)(?=[A-Z])', '_', camelcased_string).lower()
|
||||
|
||||
@staticmethod
|
||||
def snake_to_camel(snakecased_string: str):
|
||||
formatted = ''.join(word.title() for word in snakecased_string.split('_'))
|
||||
result = formatted[0].lower() + formatted[1:]
|
||||
return result
|
||||
Reference in New Issue
Block a user