File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,26 @@ def camelcase(string):
27
27
return lowercase (string [0 ]) + re .sub (r"[\-_\.\s]([a-z])" , lambda matched : uppercase (matched .group (1 )), string [1 :])
28
28
29
29
30
+ def capitalcase (string : str ):
31
+ string = str (string )
32
+ if not string :
33
+ return string
34
+ return uppercase (string [0 ]) + string [1 :]
35
+
36
+
37
+ def pascalcase (string : str ): return capitalcase (camelcase (string ))
38
+
39
+
40
+ def titlecase (string ): return ' ' .join ([capitalcase (word ) for word in snakecase (string ).split ("_" )])
41
+
42
+
43
+ def clean_camelcase (key : str ):
44
+ use_key = camelcase (key )
45
+ if use_key [- 1 ] == '_' :
46
+ use_key = use_key [0 :- 1 ]
47
+ return use_key
48
+
49
+
30
50
def ex_message (e : Exception ):
31
51
if hasattr (e , 'message' ):
32
52
return e .message
You can’t perform that action at this time.
0 commit comments