This commit is contained in:
bridge
2025-08-20 01:18:04 +08:00
parent b309b2749c
commit 7851cbba0d
14 changed files with 782 additions and 17 deletions

10
src/utils/strings.py Normal file
View File

@@ -0,0 +1,10 @@
def to_snake_case(name: str) -> str:
"""将驼峰/帕斯卡命名转换为蛇形命名。"""
chars = []
for i, ch in enumerate(name):
if ch.isupper() and i > 0:
chars.append('_')
chars.append(ch.lower())
return ''.join(chars)