More detail on the Common Lisp approach.
This commit is contained in:
parent
b3d904ca25
commit
5ea0faaba0
12
pep-0378.txt
12
pep-0378.txt
|
@ -57,11 +57,15 @@ Visual Basic and its brethren (like MS Excel) use a completely
|
||||||
different style and have ultra-flexible custom format
|
different style and have ultra-flexible custom format
|
||||||
specifiers like: "_($* #,##0_)".
|
specifiers like: "_($* #,##0_)".
|
||||||
|
|
||||||
`Common Lisp`_ uses a COLON before the type specifier to emit a COMMA
|
`Common Lisp`_ uses a COLON before the ``~D`` decimal type specifier to
|
||||||
as a thousands separator::
|
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
|
.. _`Common Lisp`: http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node200.html
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue