Aktuelle Antworten sind in Ordnung, aber wenn Sie mit Zeichenfolgen im Code arbeiten, können Sie s
String Manipulation Bibliothek verwenden. s-capitalize
macht das erste Wort in einem Satz groß.
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
nutzt jedes Wort in einem String, aber es ist ein einfacher Wrapper um Einbau-capitalize
daher Karl Voigtland's workaround gilt.
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."
+1, eine Verwarnung mit diesem jedoch: (Kapital "Dies ist ein 'Test'") "This Is A 'test'" – cobbal