Commatizing numbers: Difference between revisions

Content added Content deleted
(→‎{{header|REXX}}: corrected the "spacing" of pi (period 5).)
m (minor corrections)
Line 22: Line 22:
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 assummed to be a decimal point.
Any period in a number is assumed to be a decimal point.


The original string is never changed except by the addition of commas (or whatever is used for insertion), if at all.
The original string is never changed except by the addition of commas (or whatever is used for insertion), if at all.
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.   I.E.:   +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.   I.E.:   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 46: Line 46:
Numbers may be terminated with any non-digit character, including subscripts and/or superscript. &nbsp; 4142135624² &nbsp; or &nbsp; 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, as well as multiple characters. &nbsp; 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.


Line 52: Line 52:
default period length is 3. &nbsp;
default period length is 3. &nbsp;


I.E.: &nbsp; in this example, the period length is five: &nbsp; 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. &nbsp; 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. &nbsp; The default is 1 (one).
Line 67: Line 67:
::::* ===US$0017440 millions=== (in 2000 dollars)
::::* ===US$0017440 millions=== (in 2000 dollars)
::::* 123.e8000 is pretty big.
::::* 123.e8000 is pretty big.
::::* The land area of the earth is 57268900(29% of the surface) square miles.
::::* The land area of the earth is 57268900(29% of the surface) square miles.
::::* Ain't no numbers in this here words, nohow, no way, Jose.
::::* Ain't no numbers in this here words, nohow, no way, Jose.
::::* James was never known as 0000000007
::::* James was never known as 0000000007