Use read-string. user> (read-string ":cities") :cities
On Sunday, 17 March 2013 14:42:38 UTC-4, larry google groups wrote: > > > I have been doing stuff like (str type-as-keyword) to push values into > HTML forms, which leaves me with a string like ":cities" when the HTML > forms are submitted. I might fetch them like: > > (let [this-item (get-in request [:params "answers"])) > > If I then do: > > this-item-as-keyword (keyword this-item) > > I get a value like: > > ::cities > > but I do not want the double colons. I find myself doing awkward things > like: > > (st/replace (str (:name item)) #":" "") > > to remove the colon from the string before I transform the string into a > keyword. > > I assume there must be a more elegant way to do this? > > (Someone might be tempted to say that I should not put the keywords into > HTML forms, but that doesn't solve the problem, as I then have to call > (st/replace) before I put the value in the form, rather than when I receive > the form input -- in other words, that "solution" changes when I have to > remove the colon, but does not fix the problem.) > > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.