mirror of
https://github.com/stijndcl/didier.git
synced 2026-06-23 06:29:56 +02:00
15 lines
364 B
Python
15 lines
364 B
Python
def title_case(string):
|
|
return " ".join(capitalize(word) for word in string.split(" "))
|
|
|
|
|
|
def capitalize(string):
|
|
if len(string) > 1:
|
|
return string[0].upper() + string[1:].lower()
|
|
return string[0].upper()
|
|
|
|
|
|
def leading_zero(string, size=2):
|
|
string = str(string)
|
|
while len(string) < size:
|
|
string = "0" + string
|
|
return string
|