From: Edward Betts <edward@4angle.com>
Date: Sun, 9 Nov 2025 14:33:45 +0000
Subject: fix camelcase normalization
Forwarded: https://github.com/okunishinishi/python-stringcase/pull/47

---
 stringcase.py | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/stringcase.py b/stringcase.py
index d995ec9..ccee12f 100644
--- a/stringcase.py
+++ b/stringcase.py
@@ -15,19 +15,17 @@ def camelcase(string):
         string: Camel case string.
 
     """
-    
-    if string == "":
-        return string
 
-    string = string.replace("_","-")
-    lst = string.split("-")
-    for i in range(len(lst)):
-        if i == 0:
-            continue
-        else:
-            lst[i] = lst[i].capitalize()
-    
-    return "".join(lst)
+    snake = snakecase(string)
+    if not snake:
+        return snake
+
+    words = [word for word in snake.split("_") if word]
+    if not words:
+        return ''
+
+    head, *tail = words
+    return head + ''.join(word.capitalize() for word in tail)
 
 def capitalcase(string):
     """Convert string into capital case.
