How to capitalize the first character of each word in a string
WordUtils.capitalize(str) (from apache commons-text) (Note: if you need “fOO BAr” to become “Foo Bar”, then use capitalizeFully(..) instead)
WordUtils.capitalize(str) (from apache commons-text) (Note: if you need “fOO BAr” to become “Foo Bar”, then use capitalizeFully(..) instead)
The .title() method of a string (either ASCII or Unicode is fine) does this: >>> “hello world”.title() ‘Hello World’ >>> u”hello world”.title() u’Hello World’ However, look out for strings with embedded apostrophes, as noted in the docs. The algorithm uses a simple language-independent definition of a word as groups of consecutive letters. The definition works … Read more