24 lines
644 B
Text
24 lines
644 B
Text
document file1$={Open a text file and count the occurrences of each letter.
|
|
Some of these programs count all characters (including punctuation), but some only count letters A to Z
|
|
}
|
|
const Ansi=3, nl$=chr$(13)+chr$(10), Console=-2
|
|
save.doc file1$, "checkdoc.txt", Ansi
|
|
open "checkdoc.txt" for input as F
|
|
buffer onechar as byte
|
|
m=0
|
|
dim m(65 to 90)
|
|
while not eof(#F)
|
|
get #F, onechar
|
|
a$=chr$(eval(onechar,0))
|
|
if a$ ~ "[A-Za-z]" then
|
|
m++
|
|
m(asc(ucase$(a$)))++
|
|
end if
|
|
end while
|
|
close #F
|
|
document Export$
|
|
for i=65 to 90
|
|
if m(i)>0 then Export$=format$("{0} - {1:2:4}%",chr$(i),m(i)/m*100)+nl$
|
|
next
|
|
print #Console, Export$
|
|
clipboard Export$
|