Hi, Am 08.03.2009 um 15:26 schrieb Itay Maman:
(assert (= (capitalize "ab cd") "Ab Cd")) ? Here's my take: (defn capitalize [s] (apply str (map (fn [prev curr] (or (and (= prev \space) (Character/toUpperCase curr)) curr)) (cons \space s) s)))
That's mine: (defn capitalize [words] (let [words (.split words " ")words (for [[w & ord] words] (apply str (.toUpperCase (str w)) ord))]
(apply str (interpose " " words)))) Clojure=> (capitalize "ab cd") "Ab Cd" Sincerely Meikel
smime.p7s
Description: S/MIME cryptographic signature