I'm having trouble creating a string in clojure, I need to insert a series of blank spaces depending on the length on one of the string variables - book.
(defn blanks [book]
(let [ x(count book)]
(cond
(= "4" x) " "
(= "5" x) " "
(= "6" x ) " "
)))
(defn Key1 [x date book bookid]
(cond
(= "AB.LN.TUV" x) (str date". AB.LN. TUV. JKL. FOO. FOO. GRAVITY. "book".book."(str (blanks book)) bookid)
(= "DEF.NY.ZXY" x) (str date". DEF.NY. ZXY. JKL. . .QPR. "book". POS. "book"."bookid)
(= "DEF.LN.TUV" x ) (str date". DEF.LN. TUV. JKL. FOO. FOO. GRAVITY. "book".book."blanks bookid)
))
(defn ShowSelectedParams [& props]
(let [
entity "AB.LN.TUV"
book "ABCD"
date "21030823"
bookid "1234abcd"
]
(Key1 entity date book bookid)
))
However this returns the following, without the spaces:
"21030823. AB.LN. TUV. JKL. FOO. FOO. GRAVITY. ABCD.book.1234abcd"
What I want to get is:
"21030823. AB.LN. TUV. JKL. FOO. FOO. GRAVITY. ABCD.book. 1234abcd"
Any help with this much appreciated