(reduce
(fn [#^String s [#^CharSequence what #^CharSequence with]]
(.replace s what with))
"Foo12 Bar130 Qoo20"
{"Foo" "XF" "Bar" "XB" "Qoo" "XQ"})
2010/5/28 Oleg <[email protected]>
> Hello Guys!
>
> I have a string for example "Foo12 Bar130 Qoo20" and map like this
> {"Foo" "XF" "Bar" "XB" "Qoo" "XQ}.
> I want get: "XF12 XB130 XQ20"
>
> I want to replace words in string based on map association. What is
> the elegant way to do it? Sure, i can use loop and recur
> to make string enter the next replacement, but is there another way to
> do it better?
>
> Cheers, Oleg
>
> --
> 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]<clojure%[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