Add research on what C Sharp does.
This commit is contained in:
parent
cf93d9fc4a
commit
fd412e16c5
15
pep-0378.txt
15
pep-0378.txt
|
@ -60,10 +60,12 @@ specifiers like::
|
|||
|
||||
"_($* #,##0_)".
|
||||
|
||||
COBOL uses picture clauses like::
|
||||
`COBOL`_ uses picture clauses like::
|
||||
|
||||
PIC $***,**9.99CR
|
||||
|
||||
.. _`COBOL`: http://en.wikipedia.org/wiki/Cobol
|
||||
|
||||
`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
|
||||
|
@ -76,6 +78,17 @@ defaults to three.
|
|||
|
||||
.. _`Common Lisp`: http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node200.html
|
||||
|
||||
`C-Sharp`_ provides both styles (picture formatting and type specifiers).
|
||||
The type specifier approach is locale aware. The picture formatting only
|
||||
offers a COMMA as a thousands separator::
|
||||
|
||||
String.Format("{0:c}", 12400) ==> "$12,400"
|
||||
String.Format("{0:n}", 12400) ==> "12,400"
|
||||
String.Format("{0:0,0}", 12400) ==> "12,400"
|
||||
|
||||
.. _`C-Sharp`: http://blog.stevex.net/index.php/string-formatting-in-csharp/
|
||||
|
||||
|
||||
Proposal I (from Nick Coghlan)
|
||||
==============================
|
||||
|
||||
|
|
Loading…
Reference in New Issue