add map
This commit is contained in:
3
src/utils/__init__.py
Normal file
3
src/utils/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
"""通用工具模块。"""
|
||||
|
||||
|
||||
10
src/utils/strings.py
Normal file
10
src/utils/strings.py
Normal 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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user