There are many ways to do this, these 2 come to mind: (doto (StringBuilder. "abc") (.setCharAt 2 \d))
(apply str (assoc (vec "abc") 2 "d")) The former is probably a lot faster (uglier too)... On Wednesday, April 2, 2014 12:10:48 PM UTC+2, Andy Smith wrote: > > Hi, > > I see there are a lot of functions strings, but nothing that allows me to > create a new string with a character replaced at a given index? Am I meant > to use subs and join to do this? It seems a bit long-winded? I wonder why > there isnt a helper function out of the box to do this (or is there?) > > Thanks > > Andy > -- 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/d/optout.