Page 1 of 1

Problem in format

Posted: Mon Jun 04, 2007 4:42 pm
by Jeff
There is a problem string formatting a % character after an actual %format character. For example:

Code: Select all

(format "%% %s %%" "hello world") ; *should* => "% hello world %"
...but, in actuality, does "% hello world %%".

Posted: Mon Jun 04, 2007 5:02 pm
by Lutz
This will be fixed in 9.1.8 (due this weekend). As a workaround use:

Code: Select all

(format "%c %s %c" 37 "hello" 37) => "% hello %"
Lutz

Posted: Mon Jun 04, 2007 5:05 pm
by rickyboy
Looks like a bug. You'll have to use something like the following, as a work around.

Code: Select all

> (format "%% %s %%%s" "hello world" "")
"% hello world %"
P.S. -- Oops, Lutz beat me with another workaround. Lutz is Quick-Draw McGraw. :-)

Posted: Mon Jun 04, 2007 8:25 pm
by Jeff
Thanks guys!