2013-12-19 73 views
0

如何構造一個在兩個輸入字符串之間插入b空白字符的代碼? 具體我詢問其輸入創建一個空字符串

 (newfn "AAA" "ZZZ" 10) 

並輸出字符串 「AAA」 和 「ZZZ」 10點之間的空白

回答

1
(defn wrap-spaces [h t n] 
    (let [blanks (apply str (repeat n " "))] 
    (str h blanks t))) 

(wrap-spaces "AAA" "ZZZ" 10) 
+0

[相關問題](http://stackoverflow.com/的函數問題/ 7304879/make-string-from-sequence-of-characters)對不起,我不知道如何鏈接。 –