Correctly capitalize after opening bracket

This commit is contained in:
RemixDev 2021-09-21 09:12:15 +02:00
parent 4e16f14ffc
commit 8074cf06b7
1 changed files with 7 additions and 1 deletions

View File

@ -34,7 +34,13 @@ def changeCase(txt, case_type):
if case_type == "upper": if case_type == "upper":
return txt.upper() return txt.upper()
if case_type == "start": if case_type == "start":
return string.capwords(txt) txt = txt.split(" ")
for i, word in enumerate(txt):
if word[0] in ['(', '{', '[']:
txt[i] = word[0] + word[1:].capitalize()
else:
txt[i] = word.capitalize()
return " ".join(txt)
if case_type == "sentence": if case_type == "sentence":
return txt.capitalize() return txt.capitalize()
return str return str