Anonymous user
Commatizing numbers: Difference between revisions
m
→{{header|REXX}}: tidied up some code, used better variable names..
m (added a comment.) |
m (→{{header|REXX}}: tidied up some code, used better variable names..) |
||
Line 1,186:
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
comma: procedure; parse arg
arg ,
bla= ' ' /*literal to hold a "blank".*/
if
period= abs(every) /*use the absolute value. */▼
times= word(times 999999999, 1) /*limits # changes to be made*/
/* [↓] various error tests. */
if \datatype(period, 'W') | , /*test for a whole number. */
\datatype(times , 'W') | , /* " " " " " */
arg() >5 then return x /*# of args can't be >
period=
digs= 123456789
digsz= 1234567890
digszp= 1234567890.
if op<0 then do
beg= start
L= length9x)
fin= L -
end /* [↑] find number ending. */
else do /*Positive? Treat as numbers*/
beg= verify(n, digs, "M",start) /*find beginning of number. */
v2=max(verify(n, digszp,'M',start),1) /*end of the usable number. */
fin=verify(n, digsz, , v2) -period -1 /*adjust the ending (fin). */
end /* [↑] find ending of number*/
#= 0 /*the count of changes made. */
if
do j=
end /*j*/
return
{{out|output|text= when using the internal default inputs:}}
<pre>
|