文字列を作りたい
strの引数に要素を入れるとtoStringの結果で連結して文字列ができます。
(str "a" "b" "c") ; => "abc"
(str "a" 'b :c) ; => "ab:c"
(str '(a b c)) ; => "(a b c)"
(apply str ["a" "b" "c"]) ; => "abc"
変わった文字列関数
出力用関数の結果を文字列で返す版ですね。
(pr-str "a" "b" "c") ; =>"\"a\" \"b\" \"c\""
(prn-str "a" "b" "c") ; => "\"a\" \"b\" \"c\"\n"
(print-str "a" "b" "c") ; => "a b c"
(println-str "a" "b" "c") ; => "a b c\n"
*out*への出力を文字列で返すマクロ。CLのwith-output-to-stringみたいなやつ。
(with-out-str
(print "foo")
(print "bar")
(println "hoge")) ; => "foobarhoge\n"
Tags: [Data Structure/String]
Created By: makingx
Created At: 2010/04/25 21:27:33 Updated At: 2010/04/25 21:27:33
