Skip to content

Instantly share code, notes, and snippets.

@Jhonyrod
Last active June 8, 2017 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jhonyrod/fb0f8c844d01a833b3a802bbef248071 to your computer and use it in GitHub Desktop.
Save Jhonyrod/fb0f8c844d01a833b3a802bbef248071 to your computer and use it in GitHub Desktop.
def cap(str):
return str[0].upper() + str[1:]
def title_case(title, minor_words = ''):
return cap(' '.join(list(map(lambda x: x.lower() if minor_words.casefold().count(x.casefold()) else cap(x.lower()), title.split())))) if title else title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment