On Mon, Aug 16, 2010 at 3:34 AM, faenvie <[email protected]> wrote:
> hi clojure-users,
>
> i wonder what the reason is, that clojure(-reader)
> does not allow
>
> 1. multiline-strings like scala:
>
> """this is a
> | multiline string"""
Yes. It does, if you plug this into your repl (
user=> (use '[clojure.contrib.str-utils2 :only [split-lines join]])
user=> (defn ml-str
"Scala style multiline string"
[s]
(let [l (split-lines s)]
(join "\n" (map (fn [b]
(let [i (.indexOf b "|")]
(if (> i 0)
(.substring b (inc i))
b))) l))))
#'user/ml-str
user=> (ml-str "Hello World
|the margin will
|be deleted as per
|the request of scala
|users")
"Hello World\nthe margin will\nbe deleted as per\nthe request of scala \nusers"
user=>
--
http://www.apgwoz.com
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en