Commatizing numbers: Difference between revisions

Content deleted Content added
No edit summary
reinstated whitespace; blanks were intended to be used after sentence end, some clauses, and the examples (especially those that were highlighted or used for illustracted examples (I.E.s and E.G.s).
Line 11: Line 11:


The number may be part of a larger (non-numeric) string such as:
The number may be part of a larger (non-numeric) string such as:
::::* «US$1744 millions» ──or──
::::* «US$1744 millions»       ──or──
::::* ±25000 motes.
::::* ±25000 motes.


The string may possibly ''not'' have a number suitable for commatizing, so it should be untouched and ''no error generated''.
The string may possibly ''not'' have a number suitable for commatizing, so it should be untouched and ''no error generated''.


If any argument (option) is invalid, nothing is changed and no error ''need be'' generated (quiet execution, no fail execution). Error message generation is optional.
If any argument (option) is invalid, nothing is changed and no error ''need be'' generated (quiet execution, no fail execution).   Error message generation is optional.


The exponent part of a number is never commatized. The following string isn't suitable for commatizing: 9.7e+12000
The exponent part of a number is never commatized.   The following string isn't suitable for commatizing:   9.7e+12000


Leading zeroes are never commatized. The string 0000000005714.882 after commatization is: 0000000005,714.882
Leading zeroes are never commatized.   The string   0000000005714.882   after commatization is:   0000000005,714.882


Any period in a number is assumed to be a decimal point.
Any period in a number is assumed to be a decimal point.
Line 28: Line 28:
Leading signs ('''+''', '''-''') are to be preserved (even superfluous signs).
Leading signs ('''+''', '''-''') are to be preserved (even superfluous signs).


Leading/trailing/imbedded blanks, tabs, and other whitespace are to be preserved. E.g.: +1024 bottles of beer on the wall.
Leading/trailing/imbedded blanks, tabs, and other whitespace are to be preserved.


E.g.:   +1024       bottles of beer on the wall.
The case (upper/lower) of the exponent indicator is to be preserved. E.g.: 4.8903d-002

The case (upper/lower) of the exponent indicator is to be preserved.   E.g.:   4.8903d-002


Any exponent character(s) should be supported:
Any exponent character(s) should be supported:
Line 44: Line 46:
::::::* 10000pow(pi)
::::::* 10000pow(pi)


Numbers may be terminated with any non-digit character, including subscripts and/or superscript. 4142135624² or 7320509076<sub>(24)</sub>.
Numbers may be terminated with any non-digit character, including subscripts and/or superscript: &nbsp; 4142135624² &nbsp; or &nbsp; 7320509076<sub>(24)</sub>.


The character(s) to be used for the comma can be specified, and may contain blanks, tabs, and other whitespace characters, as well as multiple characters. The default is the comma (''',''')
The character(s) to be used for the comma can be specified, and may contain blanks, tabs, and other whitespace characters, as well as multiple characters. &nbsp; The default is the comma (''',''')
character.
character.


The ''period length'' can be specified (sometimes referred to as "thousands"). The ''period length'' is the length (or number) of the digits between commas. The default period length is 3.
The ''period length'' can be specified (sometimes referred to as "thousands"). &nbsp; The ''period length'' is the length (or number) of the digits between commas. &nbsp; The default period length is 3.


E.g.: in this example, the period length is five: 56789,12340,14148
E.g.: &nbsp; in this example, the period length is five: &nbsp; 56789,12340,14148


The location of where to start the scanning for the target field (the numeric part) should be able to be specified. The default is 1 (one).
The location of where to start the scanning for the target field (the numeric part) should be able to be specified. The default is 1 (one).
Line 72: Line 74:
::::* ␢␢␢$-140000±100 millions.
::::* ␢␢␢$-140000±100 millions.
::::* 6/9/1946 was a good year for some.
::::* 6/9/1946 was a good year for some.
<br>where the penultimate string has three leading blanks (real blanks are to be used).
<br>where the penultimate string has three leading blanks &nbsp; (real blanks are to be used).


;Also see:
;Also see:
* The Wiki entry: [http://en.wikipedia.org/wiki/Eddington_number Arthur Eddington's number of protons in the universe].
* The Wiki entry: &nbsp; [http://en.wikipedia.org/wiki/Eddington_number Arthur Eddington's number of protons in the universe].