Add research on what C Sharp does.

This commit is contained in:
Raymond Hettinger 2009-03-12 19:36:28 +00:00
parent cf93d9fc4a
commit fd412e16c5
1 changed files with 14 additions and 1 deletions

View File

@ -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)
==============================