argh i come back to paste in my answer and you beat me to it :(
i was gonna say:
(let [s ""@key1 this is a value @another-key and another value
@test1 and other value""]
(reduce (fn [m [_ k v]] (assoc m k (string/trim v))) {} (re-seq
#"(@[\w-]+)([^@]*)" s)))
much the same...
On Sun, Mar 18, 2012 at 3:14 PM, David Powell <[email protected]> wrote:
>
> You could use a regexp to pick out the key and the value - something like
> this:
>
> (into {}
> (map (fn [[_ x y]] [(keyword x) (clojure.string/trim y)])
> (re-seq #"(@[^ ]*) *([^@]*)" s)))
>
> --
> Dave
>
> --
> 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
--
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