More detail on the Common Lisp approach.

This commit is contained in:
Raymond Hettinger 2009-03-12 17:46:29 +00:00
parent b3d904ca25
commit 5ea0faaba0
1 changed files with 8 additions and 4 deletions

View File

@ -57,11 +57,15 @@ Visual Basic and its brethren (like MS Excel) use a completely
different style and have ultra-flexible custom format
specifiers like: "_($* #,##0_)".
`Common Lisp`_ uses a COLON before the type specifier to emit a COMMA
as a thousands separator::
`Common Lisp`_ uses a COLON before the ``~D`` decimal type specifier to
emit a COMMA as a thousands separator. The general form of ``~D`` is
``~mincol,padchar,commachar,commaintervalD``. The *padchar* defaults
to SPACE. The *commachar* defaults to COLON. The *commainterval*
defaults to three.
(format nil "The answer is ~:D." 229345007)
=> "The answer is 229,345,007."
::
(format nil "~:D" 229345007) => "229,345,007"
.. _`Common Lisp`: http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node200.html