Current answers are good, but if you work with strings in your code, you can use the s string manipulation library. s-capitalize capitalization of the first word in a sentence.
ELISP> (s-capitalize "can't win the war on drugs in a prison, where the hell you gonna win it?") "Can't win the war on drugs in a prison, where the hell you gonna win it?" ELISP> (s-join " " (-map 's-capitalize (s-split " " "can't win the war on drugs in a prison, where the hell you gonna win it?"))) "Can't Win The War On Drugs In A Prison, Where The Hell You Gonna Win It?"
s-titleize capital letters of each word in the string, but it is a simple wrapper around the built-in capitalize , so Karl Voigtland is used .
ELISP> (s-titleize "Girl, you can't even think of calling this shit a war.") "Girl, You Can'T Even Think Of Calling This Shit A War." ELISP> (progn (modify-syntax-entry ?' "w") (s-titleize "Girl, you can't even think of calling this shit a war.")) "Girl, You Can't Even Think Of Calling This Shit A War."
Mirzhan Irkegulov
source share