Ah, thanks. It just seemed like there should be something that did this!

- D

On Mon, May 7, 2012 at 7:38 PM, David Powell <djpow...@djpowell.net> wrote:

>
> Clojure doesn't seem to explicitly escape non-printable characters in
> String literals when you try to print them.
> You could always do it yourself with something like:
>
> (require 'clojure.string)
>
> (defn escape-nonprintable [s]
>   (clojure.string/join
>      (map (fn [c] (if (Character/isISOControl c)
>                    (str "\\" (format "%03o" (int c))) c))
>                    s)))
>
>
>
> On Thu, May 3, 2012 at 11:49 AM, DAemon <forsakendae...@gmail.com> wrote:
> > This seems like a really silly question, but if I have a string like
> > "abc\000def", how do I print it in such a way that it shows "abc\000def"?
> >
> > I've tried playing around with prn and *print-readably*, but that doesn't
> > seem to do what I want.
> >
> > Thanks!
> >
> > - DAemon
> >
> > --
> > 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 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 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

Reply via email to