Sorting a string alphabetically by line in Clojure(Script) -


suppose s string defined follows:

;; s b c 

is there clojure operation sort-alphabetically (that works in clojurescript) such (sort-alphabetically s) generates following string?

;; (sort-alphabetically s) => b c 

the following code snippet want:

(require '[clojure.string :as str])  (def s "c\nb\na")  (->> s   (str/split-lines) ; split string sequence of lines   (sort) ; sort sequence using natural order (for strings alphabetical order)   (str/join "\n")) ; join elements of sorted sequence using \n producing multiline string  ;; => "a\nb\nc" 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -