Skip to content

Commit 6ce7f6f

Browse files
committed
[update] updating the camelCase conversion
1 parent 1de33fd commit 6ce7f6f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

yuno/utils/string.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ def toCamelCase(string: str):
1919
return string
2020
split = string.split("_") # split by underscore
2121
final_split = []
22-
for s in split:
22+
for s in split[(1 if string.startswith("_") else 0):]:
2323
final_split.extend(s.split(" ")) # split by space
24-
return "".join(l.capitalize() if index > 0 else l for index, l in enumerate(final_split))
24+
return ("_" if string.startswith("_") else "") + "".join(l.capitalize() if index > 0 else l for index, l in enumerate(final_split))

0 commit comments

Comments
 (0)