我在 clojure 中创建字符串时遇到问题,我需要根据其中一个字符串变量的长度插入一系列空格 - 书。
(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)
))
但是,这将返回以下内容,但不包含空格:
"21030823. AB.LN. TUV. JKL. FOO. FOO. GRAVITY. ABCD. book.1234abcd "
我想要得到的是:
“21030823. AB.LN. TUV. JKL. FOO. FOO. GRAVITY. ABCD.*强文本*book. 1234abcd”
对此非常感谢的任何帮助