2021.4 #19

Merged
edraft merged 237 commits from 2021.4 into master 2021-04-01 10:13:33 +02:00
Showing only changes of commit 0ff9920e9e - Show all commits

11
src/cpl/utils/string.py Normal file
View File

@ -0,0 +1,11 @@
import re
class String:
@staticmethod
def convert_to_snake_case(name: str) -> str:
pattern1 = re.compile(r'(.)([A-Z][a-z]+)')
pattern2 = re.compile(r'([a-z0-9])([A-Z])')
file_name = re.sub(pattern1, r'\1_\2', name)
return re.sub(pattern2, r'\1_\2', file_name).lower()