[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Simple stringification
From: |
Andreas Röhler |
Subject: |
Re: Simple stringification |
Date: |
Mon, 22 Feb 2010 19:01:36 +0100 |
User-agent: |
Thunderbird 2.0.0.19 (X11/20081227) |
Sean McAfee wrote:
> I recently needed a function that stringifies its argument. I wrote my
> own:
>
> (defun stringify (arg)
> (format "%s" arg))
>
> But then I thought that Emacs probably ought to offer a standalone
> function for this. I can't find one, though. The docs for the format
> function state that the "%s" format sequence uses princ to print any
> object. However, (princ my-object) also prints the stringification of
> my-object to the echo area, unless called with an additional argument,
> eg. (princ my-object 'identity).
>
> Is there in fact a function that stringifies its single argument, and
> does nothing else?
>
(string 88 99 ) --> "Xc"
(number-to-string 34)"34"
BTW I'm living well with format meanwhile, inserted via abbrev.
Andreas