Letter frequency: Difference between revisions

m
→‎{{header|REXX}}: made REXX example compliant. -- ~~~~
m (→‎{{header|REXX}}: made REXX example compliant. -- ~~~~)
Line 1,136:
 
=={{header|REXX}}==
<lang rexx>/*REXX program counts the occurances of all characters in a file, */
/* {all Latin alphabet letters are uppercased first}. */
@.=0
 
parse arg fileID .
if fileID=='' then fileID='JUNK.TXT'
@.=0
 
do j=1 while lines(fileID)\==0 /*read file until cows come home.*/
_$=linein(fileID) /*get a line from the file. */
upper _$ /* ◄──────────────────────uppercase the Latin characters.*/
x=c2x(substr(_,do k,=1) for length($) /*convertexamine/count theeach character to hex. */
 
do kx=1 for lengthc2x(_substr($,k,1)) /*examine/countconvert eachthe character to hex. */
x=c2x(substr(_,k,1)) /*convert the character to hex. */
@.x=@.x+1 /*bump the character's count. */
end /*k*/
 
end /*j*/