File size distribution: Difference between revisions

m
→‎{{header|REXX}}: added support to handle commas within numbers.
m (→‎{{header|REXX}}: added support to handle commas within numbers.)
Line 602:
<br>older versions of Windows that used suffixes to express big numbers &nbsp; (the size of a file), &nbsp; and also versions
<br>that used a mixed case for showing the output text.
 
Also, some Windows versions of the &nbsp; '''dir''' &nbsp; command insert commas into numbers, so code was added to elide them.
<lang rexx>/*REXX program displays a histogram of filesize distribution of a directory structure(s)*/
numeric digits 30 /*ensure enough decimal digits for a #.*/
Line 616 ⟶ 618:
do while lines(work)\==0; _= linein(work) /*process the data in the DIR work file*/
if left(_, 1)==' ' then iterate /*Is the record not legitimate? Skip. */
parse upper var _ . . sz . /*uppercase the suffix (if any). /*uppercase suffix*/
sz= space( translate(sz, , ','), 0) /*remove any commas if present in the #*/
 
if \datatype(sz,'W') then do; #= left(sz, length(sz) - 1) /*SZ has a suffix?*/
if \datatype(#,'N') then iterate /*Meat ¬ numeric? */