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

libGdx unable to find files in android application data directory -

php - Webix Data Loading from Laravel Link -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -