#191_tests #201

Merged
edraft merged 4 commits from #191_tests into dev 2026-01-16 16:21:26 +01:00
Showing only changes of commit c8de1284fb - Show all commits

View File

@@ -18,15 +18,15 @@ class String:
String converted to CamelCase String converted to CamelCase
""" """
if re.search(r'[_\-\s]', s): if re.search(r"[_\-\s]", s):
words = re.split(r'[_\-\s]+', s) words = re.split(r"[_\-\s]+", s)
else: else:
words = re.findall(r'[A-Z]?[a-z]+|[A-Z]+(?=[A-Z]|$)', s) words = re.findall(r"[A-Z]?[a-z]+|[A-Z]+(?=[A-Z]|$)", s)
words = [w.lower() for w in words if w] words = [w.lower() for w in words if w]
if not words: if not words:
return '' return ""
return words[0] + ''.join(w.capitalize() for w in words[1:]) return words[0] + "".join(w.capitalize() for w in words[1:])
@staticmethod @staticmethod
def to_pascal_case(s: str) -> str: def to_pascal_case(s: str) -> str:
@@ -40,12 +40,12 @@ class String:
String converted to PascalCase String converted to PascalCase
""" """
if re.search(r'[_\-\s]', s): if re.search(r"[_\-\s]", s):
words = re.split(r'[_\-\s]+', s) words = re.split(r"[_\-\s]+", s)
else: else:
words = re.findall(r'[A-Z]?[a-z]+|[A-Z]+(?=[A-Z]|$)', s) words = re.findall(r"[A-Z]?[a-z]+|[A-Z]+(?=[A-Z]|$)", s)
return ''.join(word.capitalize() for word in words if word) return "".join(word.capitalize() for word in words if word)
@staticmethod @staticmethod
def to_snake_case(chars: str) -> str: def to_snake_case(chars: str) -> str: