··········@aol.com (Pionkowski) writes:
> How do I convert an integer to a string?
> for ex: i is 3 ... given i , how do I coerce it to: "3"
>
> thanks, Rick Pionkowski
> ··········@aol.com
According to taste, one of these:
(write-to-string 3 :base 10 :radix nil)
(format nil "~D" 3)
Pionkowski wrote:
>
> How do I convert an integer to a string?
> for ex: i is 3 ... given i , how do I coerce it to: "3"
>
> thanks, Rick Pionkowski
> ··········@aol.com
(defun string-value-of (x)
(princ-to-string x)
)
Kiritsuke
ICAD Weenie
Kiritsuke <··@nwlink.com> writes:
> Pionkowski wrote:
> > How do I convert an integer to a string?
>
> (defun string-value-of (x) (princ-to-string x))
Although this is heavily used, robust code is better off to use
(WRITE-TO-STRING x :BASE 10 :RADIX NIL)
so that it is insulated from the effects of *PRINT-BASE* and *PRINT-RADIX*.
Using (FORMAT NIL "~D" x) mostly also works but may be a bit more overhead.