Skip to content

titlecase

string  titlecase(string str)

Converts a normal sentence into titlecase. The rules in use are as follows:

  • First and last world are always capitalized
  • Subtitles are capitalized
  • Capitalize all words other than: articles, prepositions, and conjunctions.
  • Hyphenated words that are capitalized should have their second part capitalized as well
  • Words that already contain capital letters are not modified